I am currently configuring an API in vDesigner 2.0. The API is successfully executing and I see “SUCCESS” in the logs. However, when I configure the response using the “Define Object” parameter, the data appears as undefined in my application’s debugger. On the other hand, when I switch to using the “Complete Object” option, the data is displayed correctly.
@AnushkaGupta Please look into this
Hi @Shalini_Rai
The ideal way to configure API in vDesigner2.0 can be explained in two ways for Response Handling:
Complete Object: If you don’t need any specific key or the whole response for any further configuration, then you can opt for Complete Object for Response Handling.
Also, using complete object in the configurations of API to costume the response in the application can make your Application slow, because then many unnecessary keys will consume time.
Define Object: If you need any specific keys or the response to consume it in the further development of the Application, then you can opt for Define Object as Response Handling.
To use the defined object in a right manner, please follow these steps:
Suppose you are configuring an API for PAN Authentication.
In Request Body, the API needs PAN Number only then the JSON for it will be:
{"Pan_No":" "}
For Response, Copy the response that you get in your vLogs which looks like this:
{
"services": {
"PAN_AUTHENTICATION": {
"records": [
{
"primary_key": "",
"data": [
{
"status": "SUCCESS",
"message": "Successfully Executed!",
"response": [
{
"result": {
"name": "Anushka Gupta"
},
"request_id": "1e3d1ebe-ef4f-4090-9b5c-43484acc2f69",
"status-code": "101"
}
]
}
]
}
],
"responseHandledBy": "MOBILE APP",
"isSuccessRuleValidated": true
}
}
}
Now, we will optimize this response for seamless integration into this structure:
{
"status": "SUCCESS",
"message": "Successfully Executed!",
"response": [
{
"result": {
"name": "Anushka Gupta"
},
"request_id": "788835fb-f6ad-41ea-ae69-2c9572ada10e",
"status-code": "101"
}
]
}
As you can see, I have removed the Services, API Name, records, and data key which creates the undefine object issue in the debugger.
Using this optimized form of response will take less time to render the response on the application i.e. No Buffer time.
Note: Provide the same optimized response in the entity structure in which you will store the response for the application.