Hello. I am trying a PUT call with the API, and I get this message error that I don't know what means and how I can fix. Any help?
Thank you in advance.
Hi @adqa,
no, PHP isn't among languages I use (sorry).
I can try to help you with regard to the type of response received (HTTP 411)
Beyond the length, you need to make sure you pass a payload in the request body. PHP's array (x => y) method creates an array or dictionary, but what you need to report in the body's request is the resulting JSON.
Something like:
json_encode(array('billing_state' => 'Billed'))
Also make sure you have set the content-type as the request header to 'application/json'. This is the classic form for your type of request
PUT /api/v1/reports/connections/XXXXXXXXXXXXXXXXXXXXXXXX Content-Type: application/json {'billing_state' : 'Billed'}
Regards
I'm not familiar with PHP.Maybe @DomLan could take a look ?
Hi! I am using PHP, and I use http.php and oauth_client.php libraries.
This is the call that shows the error:
$success = $client->CallAPI('https://webapi.teamviewer.com/api/v1/reports/connections/XXXXXXXXXXXXXXXXXXXXXXXX', 'PUT', array('billing_state' => 'Billed'), array('FailOnAccessError'=>true), $user);
In the other hand, if I make a GET call, it works correctly.
Thank you for your response
Which computer programing language you are using ?Please post small snippet/ reproducer to show us: How do you write your code ?
remark: of course anonymize them.