Skip Navigation
Expand
Importing custom code elements from version control into the target site using Element Manager APIs
Answer ID 12556   |   Last Review Date 10/26/2023

How do I import configuration elements from version control using Element Manager APIs?

Environment: Oracle B2C Service Browser User Interface (BUI), Element Manager

Resolution:

Element Manager APIs now allows direct import of configuration elements and that can be used to import configurations from version control. This capability allows the customers to automate the process of deploying configuration elements to a test site. Thus reduces the development cycle time by eliminating the need to manually deploy configuration elements to a test site. The supported element types for import from version control are

  • Browser Extensions
  • Desktop Add-Ins
  • Custom Process Models
  • Custom Scripts
  • Reports (only from a package)

Some highlights of the feature are:

  • Signing of the certificate for the element is by-passed when the element is imported from version control or already created package via the import API.
  • The import of elements from version control or already created package is singleton only.
  • The dependencies of the custom code elements, if any has to be imported separately via Browser UI or via APIs.

The mandatory parameters to be passed in the body of the API call.

  • Common mandatory parameters for all element types.
  1. Name: Name of the Import
  2. Package Content: Element files encoded in Base-64 format. For Browser Extension it should be base64 encoded zip file, for Add-Ins it should be base64 encoded dll or zip file, and for CPMs it should be base64 encoded php file.
  3. Import Type: “CustomImport”
  • Mandatory custom import attributes for Browser Extension.
  1. Item name: Name of the browser extension
  2. Item type: “BrowserExtension”
  3. Extension Type: Type of the browser extension. One of “Analytics”, “Workspace”, “Report”, or “Console.
  4. Extension Init File: Initialization file for the browser extension

Click the plus sign next to the appropriate heading below to expand that section for viewing.

Click here to expand example

Request Headers:

{

"USERSESSION”: “{{USERSESSION-Token}}”,
"API_VERSION”: “1",

"Content-Type”: “application/json"

}

        Request Body:

{

  "name": "ExtensionCustomImport",

  "packageContent": "{{base-64 content}}",

  "importType": "CustomImport",

  "attributes": {

      "customImportAttributes":{

          "itemName": "SampleExtensionName",

          "itemType": "BrowserExtension",

          "extensionAttributes":{

              "extensionType": "Analytics",

              "extensionInitFile": "index.html",

                                                  "extensionConfigFile":"s2_analytics.json",

                                                  "extensionSchemaFiles": ["s2_analytics.json"],

                                                  "notes": "This is a test comment"

          }

      }

  }

}

        Response Body:

{

                "description": "Prepare package for import",

                "id": 100015,

    "href":  "http://mysite.example.com/AgentWeb/api/elementmanager/import/EMPackages/100015"

}

  • Mandatory custom import attributes for Desktop Add-Ins.
  1. Item name: Name of the Desktop Add-In with extension type. Extension Types: .dll or .zip.
  2. Item type: “DesktopAddIn”

Click here to expand example

Request Headers:

{

"USERSESSION”: “{{USERSESSION-Token}}”,
"API_VERSION”: “1",

"Content-Type”: “application/json"

}

        Request Body:

{

  "name": "AddInCustomImport",

  "packageContent": "{{base-64 content}}",

  "importType": "CustomImport",

  "attributes": {

      "customImportAttributes":{

          "itemName": "SampleAddInName.dll",

          "itemType": "DesktopAddIn",

                                  "addInAttributes": {

              "notes":"Test notes"

          }

      }

  }

}

        Response Body:

{

                "description": "Prepare package for import",

                "id": 100016,

    "href":  "http://mysite.example.com/AgentWeb/api/elementmanager/import/EMPackages/100016"

}

  • Mandatory custom import attributes for CPMs.
  1. Item name: Name of the CPM Object Event Handler
  2. Item type: “ObjectEventHandler”

Click here to expand example

Request Headers:

{

"USERSESSION”: “{{USERSESSION-Token}}”,
"API_VERSION”: “1",

"Content-Type”: “application/json"

}

        Request Body:

{

  "name": "CPMCustomImport",

  "packageContent": "{{base-64 content}}",

  "importType": "CustomImport",

  "attributes": {

      "customImportAttributes":{

          "itemName": "SampleObjectEventHandlerHeaderName",

          "itemType": "ObjectEventHandler"

      }

  }

}

        Response Body:

{

                "description": "Prepare package for import",

                "id": 100017,

    "href":  "http://mysite.example.com/AgentWeb/api/elementmanager/import/EMPackages/100017"

}

  • Mandatory custom import attributes for Custom Scripts.
  1. Item name: Name of the custom script with extension. Extension types: .php or .phph
  2. Item type: “Custom Script”

Click here to expand example

Request Headers:

{

"USERSESSION”: “{{USERSESSION-Token}}”,
"API_VERSION”: “1",

"Content-Type”: “application/json"

}

        Request Body:

{

  "name": "CustomScriptCustomImport",

  "packageContent": "{{base-64 content}}",

  "importType": "CustomImport",

  "attributes": {

      "customImportAttributes":{

          "itemName": "SampleCustomScript.php",

          "itemType": "Custom Script"

          "customScriptAttributes": {

          "subFolderPath": "subfolder1/subfolder2"

}

      }

  }

}

        Response Body:

{

                "description": "Prepare package for import",

                "id": 100018,

    "href":  "http://mysite.example.com/AgentWeb/api/elementmanager/import/EMPackages/100018"

}

 

  • Mandatory custom import attributes for Reports.
  1. Item type: “Report”

Click here to expand example

Request Headers:

{

"USERSESSION”: “{{USERSESSION-Token}}”,
"API_VERSION”: “1",
"Content-Type”: “application/json"

}

        Request Body:

{

  "name": "ReportCustomImport",

  "packageContent": "{{base-64 content}}",

  "importType": "CustomImport",

  "attributes": {

      "customImportAttributes":{

          "itemType": "Report"

      }

  }

                }

Additional Information:

Element Manager Rest API Current Capabilities

DevOps with Element Manager