Knowledge Base

Adding Content with Extract-Transform-Load Tool's REST API

This article provides an example of how to log into the CMS Web API and an example of how to import JSON via the post method.


The Extract-Transform-Load (ETL) tool provides a data push API to import JSON data into Ingeniux CMS. Using this process requires two steps: 1) Logging into the CMS Web API and then 2) Importing JSON data via post.

To import JSON data with the ETL REST API:

  1. Execute the CMS REST Web API Login method to retrieve an authentication token.

    The CMS Web API Login method returns an authentication token that will be used for subsequent requests.

    {
        "info": {
            "_postman_id": "b44fd5de-827d-4032-afff-94cb1589a0eb",
            "name": "JSON Import Call via Web API",
            "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
        },
        "item": [
            {
                "name": "JSON Import Call",
                "event": [
                    {
                        "listen": "prerequest",
                        "script": {
                            "id": "a51532a6-db7e-49a9-817d-ee9482839e83",
                            "exec": [
                                "const postRequest = {\r",
                                "  url: 'https://staging.ingeniux.com/REST/MembershipProvidersServices.svc/Login',\r",
                                "  method: 'POST',\r",
                                "  header: {\r",
                                "    'Content-Type': 'application/json',\r",
                                "  },\r",
                                "  body: JSON.stringify({ \r",
                                "        \"userName\": \"administrator-1\", \r",
                                "        \"password\": \"unbreakable963!\", \r",
                                "        \"membershipProviderName\": \"\" \r",
                                "    })\r",
                                "};\r",
                                "pm.sendRequest(postRequest, (error, response) => {\r",
                                "    console.log(response.message);\r",
                                "    pm.environment.set('igxa-token', response.message);\r",
                                "});"
                            ],
                            "type": "text/javascript"
                        }
                    }
                ],
                "response": []
            }
        ]
    }
  2. Submit JSON data objects to the ETL API via POST submissions to its REST API.

    After the login has succeeded, the second step is to call the data submission API. The HTTP REST API posts JSON content to the ETL, which creates content items in the CMS. In the example below, the REST API posts Title and Abstract element content to https://staging.ingeniux.com/staged-cms/apps/CSVImport/Import/import, where ETL has been installed; then ETL imports these elements into the appropriate CMS schema instance, defined in its settings.xml.

    {
    	"info": {
    		"_postman_id": "b44fd5de-827d-4032-afff-94cb1589a0eb",
    		"name": "JSON Import Call via Post",
    		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    	},
    	"item": [{
    		"name": "JSON Import Call",
    		"request": {
    			"method": "POST",
    			"header": [{
    				"key": "X-IGXAToken",
    				"type": "text",
    				"value": "{{igxa-token}}"
    			}],
    			"body": {
    				"mode": "raw",
    				"raw": "{\r\n   \"title\": \"Test Title \",\r\n   \"Abstract\": \"<p>This document contains test content.<\/p>\",\r\n }\r\n\r\n\r\n"
    			},
    			"url": {
    				"raw": "https://staging.ingeniux.com/staged-cms/apps/CSVImport/Import/import",
    				"protocol": "https",
    				"host": [
    					"administrator-1",
    					"unbreakable963!",
    					"com"
    				],
    				"path": [
    					"staged-cms",
    					"apps",
    					"CSVImport",
    					"Import",
    					"import"
    				]
    			}
    		},
    		"response": []
    	}   
        ]
    }
  • PRODUCT: CMS
  • VERSION: CMS 10
  • RELEASE: 10.x
  • Published: March 10, 2021
  • LAST UPDATED: February 27, 2024
  • Comments: 0

Please login to comment

Comments


There are no comments yet.