teamviewer.com link icon
or
Ask The Community

HTTP Error 411. The request must be chunked or have a content length.

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.

Comments

  • mLipok
    mLipok Posts: 778 Star

    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.

     

    Regards,
    mLipok , AutoIt MVP
  • adqa
    adqa Posts: 2

    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

  • mLipok
    mLipok Posts: 778 Star

    I'm not familiar with PHP.
    Maybe @DomLan  could take a look ?

    Regards,
    mLipok , AutoIt MVP
  • DomLan
    DomLan Posts: 490 Star

    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

    Domenico Langone
    MCSD: App Builder
    Did my reply answer your question? Accept it as a solution to help others.
    Find this helpful? Say thanks by clicking on the Thumbs Up button.
Sign In or Register to comment.