This topic describes how to develop and use component APIs.
The process involves three main steps:
Obtain the business component data structure.
The data structure of a business component is the same as its mock.json file, except for optional parameter fields.
Write the API.
Form submission API
This API saves the latest component data after a component is modified.
{ apiData:'{ // Component data (jsonString) "title":"title", ... "params": "{"id":"0"}", // params: Extra parameters for this submission API. }', pageId: 134, // Page ID componentId: "3bb79d72-52f6-4fe8-b07a-95e3ae193c0c" // The unique identifier for the component, generated on the canvas in the editor. }Data source API
You can retrieve the latest data for the component.
// Parameters { pageId: 134, componentId:"3bb79d72-52f6-4fe8-b07a-95e3ae193c0c", apiData: '{ "params":"{"id":"0"}", // Extra parameters }' } // Return value apiData: '{ // Component data (jsonString) "title": "title", ... "params": "{"id":"0"}" , }', pageId: 134, componentId:"3bb79d72-52f6-4fe8-b07a-95e3ae193c0c"
Ingestion API
In the API Management module of the Intelligent App Building Console, create an API, register it, and specify the components that can use it. For more information, see Create an API. After an API is created, both the API and the components that use it must be validated. You can view and use the API in the Page Builder only after it passes validation.