Updated on 2022-02-24 GMT+08:00

Service API Calling Process and Precautions

The methods for calling other APIs are similar to those for calling service APIs. For details, see Calling Service APIs.

  • The following figure shows the flow for calling a service API.

  • The following figure shows the profile file used in the Java SDK Demo. There is only one Brightness service, which contains a brightness attribute and a PUT command. When calling a device command or device service API, change the service, attribute, or command name to the corresponding name if the following profile content is not used.

  • To create a profile, perform the following steps:

    Log in to the Developer Center, choose Product > Product Development > Add > Customization, and click Customization to open the Set Product Information page. Specify Product Name, Model, Manufacture ID, Industry, Device Type, and Protocol Type, and click Create. Click +Add Service to add attributes and commands based on device functions, and click Save.

    NOTE:

    You are advised to call the API to register the device after the profile file is defined.

  • The values of DeviceType, ManufacturerId, ManufacturerName, and Model must be the same as those defined in the profile file.
  • The accessToken can be managed by the SDK or third-party applications. For details, choose Secure Application Access > Periodically Refreshing a Token in the Northbound Java SDK API Reference.