Step 4: Update entity through API
Last updated
Last updated
Once the Entity and API are created, the API can be used to populate multiple records in the Entity “UserName_Acc_Activities”.
To test the API, click the [Test] button.
The Test API box will display the “Entity actions” toggle button disabled. (Note: If “Entity actions” is not enabled, testing an API that is using entity actions will result in the status of “failed” in the response.) To allow the Entity to be updated or created with entity actions, click the “Entity actions” toggle button.
Select the default API gateway as “UserName_Acc_AddCustomer”. The default API gateway will be selected if the user does not select an API gateway.
In the “Request” section, update the Json object in the Request section with values to test.
In this case, we add two (2) activities for the customer with a certain customer_id (Users must ensure to add a customer_id present in the entity “UserName_Acc_customers,” else it will give an error message).
Copy the following code and paste it into the Request section on the Test Console. (Ensure the data is present in the target entity)
{ "customer_id": "7c55d71fece9e418787f9628a3d77d19c",
"activities": [{
"Activity_Type": "Information Request/Query",
"Activity_Description": "test email",
"Activity_DateTime": "2021-03-03",
"Activity_Priority": 1,
"Activity_AssignedTo": "Test HD Team",
"Activity_CreatedBy": "Test Sales Team"
},
{
"Activity_Type": "Incoming call",
"Activity_Description": "test Incoming call",
"Activity_DateTime": "2021-11-29",
"Activity_Priority": 2,
"Activity_AssignedTo": "Test Marketing",
"Activity_CreatedBy": "Test Sales Team"
}
]
}
``
The test Console will be as per the image below.
To test if the record is created in the target entity, click the [Test API] button.
The Response section in the Test dialog displays a record creation success message.
In the list of Entities, click on “UserName_Acc_Activities”. The created record will be displayed.
Note: If the “Entity actions” toggle button is disabled, and the API is tested, the Response section in the Test dialog displays an error message when the [Test API] button is clicked.