Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I tried to do the DELETE operation using the tREST component. But, If I choose the DELETE method then the HTTP Request Body was disappeared. But in my API, I need to pass a few information in the form of JSON as Body Parameters. Please help here or suggest any alternate solution.
Thanks in advance
I used the tSystem component and curl like below and I got the expected output.
curl -i -X DELETE \"https://api-d.docusign.net/management/v2.1/organizations/{{ORG_ID}}/accounts/{{ACC_ID}}/products/users\" -H \"Content-Type: application/json\" -H \"Authorization: Bearer <TOKEN>\" -d \"{\\\"user_email\\\": \\\"jhbsvjhbshb\\\",\\\"user_id\\\": \\\"kjdvkjdhvdd\\\",\\\"product_ids\\\": [\\\"dkhbfkvjdb\\\"]}\"
Hello @McJingles McJingles ,
HTTP DELETE requests, like GET and HEAD requests, should not contain a body, as this may cause some servers to work incorrectly. But you can still send data to the server with an HTTP DELETE request using URL parameters
For your case, please use URL parameters to send the data in tREST component.
see https://reqbin.com/req/ke7ui8ri/http-delete-body
Best regards
Aiming
Thanks for your response @achen (Talend Beijing Tech Co., Ltd.)
Can you please let me know in detail how can I implement it in Talend?
More info -
URL - https://api-d.docusign.net/management/v2.1/organizations/{{ORG_ID}}/accounts/{{ACC_ID}}/products/users
Path parameters - ORG_ID, ACC_ID
Body parameters -
{
"user_id": "skjrdsgkndglkg",
"product_ids": [
"kishgvkjvd"
]
}
The path parameters can bind within the URL automatically. But how can I pass the body parameters?
Hello @McJingles McJingles ,
The URL should be like
https://api-d.docusign.net/management/v2.1/organizations/{{ORG_ID}}/accounts/{{ACC_ID}}/products/users?user_id=xxxxx&product_ids[]=xxxx
After formatting like the above URL, I got the below error. Moreover, this is the same error I got from the beginning.
BODY -
{
"error":"invalid_request",
"error_description":"Data must be provided in the request body",
"reference_id":"3197"
}
ERROR_CODE - 400
I used the tSystem component and curl like below and I got the expected output.
curl -i -X DELETE \"https://api-d.docusign.net/management/v2.1/organizations/{{ORG_ID}}/accounts/{{ACC_ID}}/products/users\" -H \"Content-Type: application/json\" -H \"Authorization: Bearer <TOKEN>\" -d \"{\\\"user_email\\\": \\\"jhbsvjhbshb\\\",\\\"user_id\\\": \\\"kjdvkjdhvdd\\\",\\\"product_ids\\\": [\\\"dkhbfkvjdb\\\"]}\"