jorgeorbit Posted June 21, 2020 Report Share Posted June 21, 2020 I am getting the response: ["Code"]=> string(22) "IncorrectBodyParameter" ["Message"]=> string(73) "Cannot perform operation because the body parameter is absent or invalid." This is my PHP code: $accesstoken = '___my token___'; $ch = curl_init(); $headr = array(); $headr[] = 'Content-length: 0'; $headr[] = 'accept: application/json'; $headr[] = 'Authorization: bearer '.$accesstoken; curl_setopt($ch, CURLOPT_HTTPHEADER,$headr); curl_setopt($ch, CURLOPT_POST,true); // Initiate curl curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Set the url $mnxdb_url = "___my url taken from swager__"; curl_setopt($ch, CURLOPT_URL,$mnxdb_url); // Execute $result=curl_exec($ch); // check for error if ($result === false) { print_r('Curl error: ' . curl_error($ch)); } // Closing curl_close($ch); Quote Link to comment Share on other sites More sharing options...
0 Vitalikssssss Posted June 22, 2020 Report Share Posted June 22, 2020 Hi @jorgeorbit, Perhaps you did not follow the correct syntax while specifying the values of the fields. It would be easier to narrow down the issue if you send a Body of the request and specify datatypes of fields which you use to create a record. Regards, vitalikssssss Quote Link to comment Share on other sites More sharing options...
0 jorgeorbit Posted June 22, 2020 Author Report Share Posted June 22, 2020 2 hours ago, Vitalikssssss said: Thank you for your reply Vitaliks, This is the request: https://medinexo.caspio.com/rest/v2/tables/MNX_Currencies/records?q.select=Currency_Name%2CCurrency_Alphabetic_Code%2CCurrency_Numeric_Code%2CCurrency_USD_Exchange%2C In swager the response body looks like this: { "Result": [ { "Currency_Name": "Afghani", "Currency_Alphabetic_Code": "AFN", "Currency_Numeric_Code": 971, "Currency_USD_Exchange": 77.8389 }, { "Currency_Name": "Lek", "Currency_Alphabetic_Code": "ALL", "Currency_Numeric_Code": 8, "Currency_USD_Exchange": null }, 2 hours ago, Vitalikssssss said: https:// cify datatypes of fields which you use to create a recor Quote Link to comment Share on other sites More sharing options...
0 autonumber Posted May 4, 2023 Report Share Posted May 4, 2023 Hi - Just want to share, I encountered the same issue but in my case, it is working in Swagger, I was able to return records but when I used the URL on my third-party application, I get the 'IncorrectBodyParameter' error message and I just realized that I am copying the 'CURL' URL instead of the 'Request' URL. When I used the Request URL, it worked. This article might also help - https://howto.caspio.com/web-services-api/rest-api/error-handling/ Quote Link to comment Share on other sites More sharing options...
Question
jorgeorbit
I am getting the response:
$ch = curl_init();
$headr = array();
$headr[] = 'Content-length: 0';
$headr[] = 'accept: application/json';
$headr[] = 'Authorization: bearer '.$accesstoken;
curl_setopt($ch, CURLOPT_HTTPHEADER,$headr);
curl_setopt($ch, CURLOPT_POST,true);
// Initiate curl
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Set the url
$mnxdb_url = "___my url taken from swager__";
curl_setopt($ch, CURLOPT_URL,$mnxdb_url);
// Execute
$result=curl_exec($ch);
// check for error
if ($result === false)
{
print_r('Curl error: ' . curl_error($ch));
}
// Closing
curl_close($ch);
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.