Step 3: Update entity through API
Last updated
Last updated
Once the Entity and API are created, the API can be tested to update records in the Entity “UserName_Acc_customers.”
To test the API, click on 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 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”. If the user The default API gateway will be selected if the user does not select an API gateway
In the “Request” section, update the Json object as follows:
{"Address":"Rose Street",
"City":"Kuala Lumpur",
"Customer_Value":5,
"Country":"Malaysia",
"Email":"JaneDoe@mail.com",
"First_Name":"Jane",
"IsActive":true,
"Join_Date":"2021-09-15",
"Last_Name":"Doe",
"Phone":"1237865",
"Rating":1000,
"Zip_Code":"45"}
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.
If the “Entity actions” field is disabled and the API is tested, the Body section in the Test dialog displays an error message when the [Test API] button is clicked.
In the list of Entities, click on “UserName_Acc_customers”. The created record will be displayed. Note that, as per requirements, the value in the “Customer_Value” field is returned as “0” and the value in the “Rating” field is returned as “1” as defined in the “Actions”.