Skip to main content
Question

POST requests require a Content-length header.

  • May 23, 2025
  • 3 replies
  • 10 views

Forum|alt.badge.img

This bash curl statement used to work and did provide me the requestToken from a filerequest as stated https://support.box.com/hc/en-us/articles/360043697554-Configuring-Individual-Shared-Link-Settings

requestToken=$(curl -c cookies.txt -d "password=$filePassword" -i -L -s -X POST https://ibm.box.com/s/eyvgkuomicharkia7nxyoe9jec6xxbnl | sed -n 's/.*"requestToken":"\([^"]*\)".*/\1/p')

returns for example: a398b2203ca210b0cdc59d248d3cef4483504ee55f1a9209fdb5cb4e44ed2f36

Since last week, it compains about "POST requests require a Content-length header."

so i added a Content-Length header like

requestToken=$(curl -c cookies.txt -d "password=$filePassword" -H "Content-Length: 17" -i -L -s -X POST https://ibm.box.com/s/eyvgkuomicharkia7nxyoe9jec6xxbnl | sed -n 's/.*"requestToken":"\([^"]*\)".*/\1/p')

however the request never completes ...eventually following error is thrown

"The server encountered a temporary error and could not complete your request."

Why is the behaviour changed?

 

 

 

 

3 replies

Forum|alt.badge.img

Hi Pieter, 

Welcome to Box Community and glad to help! 

Please reach out to your internal helpdesk team to address this query. 

Thanks for posting! 


Forum|alt.badge.img

Hi Rona, is this realy something related to my company's change in implementation?

Just wondering is there maybe another way to fetch the requestToken anonymously
Went over the docs but could not directly find something usefull
Only thing related to "anonymous" was a client_id = 2
But maybe you have something better? 
thanks in advance,


Forum|alt.badge.img

seems like the issue is resolved, without having to add the Content-Length