Skip to main content
Question

Error on the cUrl script for metadata

  • May 21, 2025
  • 1 reply
  • 12 views

Forum|alt.badge.img

I'm Trying to create metadata on file using cUrl script like below but getting the error: 400 bad request.

 

curl -f -H "Authorization: Bearer HLLjqczWmFB8aWt35gjg3ECaSQpgMLlS" -H "Content-Type: application/json" -X POST https://api.box.com/2.0/files/***number removed for privacy***57/metadata/enterprise_1749521/template

 

Just FYI, I have created the "template" of template already.

Any idea on this?

 

thanks

1 reply

Forum|alt.badge.img

Good afternoon ,

 

if you look the documentation the URL would be something like:

 

curl https://api.box.com/2.0/files/***number removed for privacy***1/metadata/enterprise/marketingCollateral \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "audience1": "internal", "documentType": "Q1 plans", "competitiveDocument": "no", "status": "active", "author": "Jones", "currentState": "proposal"}' \
-X POST

 

In your case, there is no body (-d part) and you have a -f that seems more related to file actions like update a document.

 

Look at https://developer.box.com/reference#create-metadata to see exactly what it is needed.

 

Regards