I have created an API with a POST method. This method takes one of the request body parameters as collection type. But when I save this operation, I get an error. PFA image.
For example, the request payload is -
{
model: "xyz",
messages: [{ role: "user", content: "some test values" }]
}
Here, the messages parameter is causing an error, and due to this the request has the Payload parameter empty because of which the API is returning 400 status code.
Also, is it possible to save a template in the request body such that I can pass the custom value from Iris to Foundry's API? In the below example, I just want to pass "some test values" from Iris UI and replace the "custom-value" with it.
Example,
{
model: "xyz",
messages: [{ role: "user", content: "custom-value" }]
}
Please share your thoughts.
Hello @Bibin Philip
Please review few inputs below, see if these work in your scenario. Thank you.
- Here is a publicly available dummy JSON POST service that I used in my example.
Endpoint URL: https://dummyjson.com/products/add
- This dummy JSON POST service expects below request payload
{
"title": "iPhone 9",
"description": "An apple mobile which is nothing like apple",
"price": "549",
"discountPercentage": "12.96",
"rating": "4.69",
"stock": "94",
"brand": "Apple",
"category": "smartphones"
}
- While creating integration service in Foundry, I created the integration service with "Target Http Method" as POST
- Defined below highlighted JSON structure in the "Request Template" of integration service.
- Defined "Request Input" parameters for the integration service as highlighted below.
This configuration of the integration service worked successfully. Thank you.
So in your scenario, please define the Request Template as below, and define content as one of the Request Input parameters. Thank you.
{
model: "xyz",
messages: [{ role: "user", content: "$content" }]
}
Thanks and Regards,
Venkata Raju Bankapalli
Thank you. This helped to replace the placeholder with the actual content.