Skip to main content
Version: 4.0

Overview

This document dedicates in demonstrating the internal usage of common openAPIs in supOS platform.

info

OpenAPIs are often used together with general HTTP requests such as GET, POST, DELETE and PUT.

Operation

Internal use of open APIs is conducted inside an object service. In this section, 4 types of requests will be covered.

  1. Log in to supOS platform, in design center, click Object Model Management.
  2. Select a template, inside it click Service.
  3. Add a new service and enter basic information of it.
    info

    Make sure to set the output type to JSON.

  4. Write the corresponding script in the service and then click Debugging to check the result from the pop-up window.
    tip

    You can write your own script which requires a basic HTTP request body code and an open API path code. Both of them you can get from Open API and check the video class Open API Internal Usage to learn the method.

baseUrl = "/open-api/supos/oodm/v2/template/{template namespace}/{template alias}/instance"

var param = {
"appAccessMode": "PUBLIC", //whether can be seen in all applications (PUBLIC or PRIVATE). Required
"appName": "system", //application name. Required
"attributeValues": [ //array of objects. Existing attributes of the parent template
{
"attributeName": "test",
"attributeNamespace": "system",
"attributeValue": "123"
}
],
"code": "xxxxx", //string. Instance code
"comment": "create test instance", //string. Instance description
"displayName": "createInstance", //string. Display name of the instance. Required for entity instance
"enName": "createInstance", //string. Instance alias. Required

}
var headers = {}
var httpService= services["HttpClientService"];
httpService.post(baseUrl, JSON.stringify(param), headers, 10000)