We are making a request to an REST API.
The API expects one of the objects to have the following JSON structure:
"properties" : {
{ "key_1" : "value_1" },
{ "key_2" : "value_2" }
}, hence generate the "properties" as a list of items that contain a key/value pair as values like the example below. And then, use JSON_Objectify in the OnBeforeRequest to get the above expected result.
"properties" : [
{
"key" : "key_1" ,
"value" : "value_1"
},
"key" : "key_2" ,
"value" : "value_2"
]
The issue here, is when we call the JSON_Objectify in the OnBeforeRequest, it throws the error "Object reference not set to an instance of an object." but if I manually pass the request as a JSON in the demo, it works. Could you please help us understand what could be the issue here?
The path we used is: "tools.function.parameters.properties"
Thanks.
In the attachments you may find "request-body.txt" which is the request example the action gets as input parameter and the "request-body-json.txt", which is the same content as .txt, but in JSON format.
Hi Luiz,
Just to clarify, is the following output what you're looking for?
{{
"properties": [
"key": "prompt",
"value": {
"type": "string",
"description": "The prompt that will be used for the function_name."
}
"key": "n",
"type": "integer",
"description": "The number of times the prompt should be used."
}}
Thanks,
Amit