Skip to main content
Question

Urgent - When applying metadata to file i am getting invalid Request contains invalid parameters

  • May 23, 2025
  • 3 replies
  • 24 views

Forum|alt.badge.img

Trying to apply metadata to file ,i created a template from the admin console with one metadata field
name of the metadata is test name of field is "recorddateclosed" type text.

request :
{Method: POST, RequestUri: 'https://api.box.com/2.0/files/1152853018167/metadata/enterprise/test', Version: 1.1, Content: System.Net.Http.StringContent, Headers:
{
Authorization: Bearer TaOblEVIgjXXXXXXDu5hw1s4XXXXXjkZ
Content-Type: application/json; charset=utf-8
}}

metadata :
{[recorddateclosed, { Value = 01-01-0001 00:00:0 }]}
scope:"enterprise"
template :"test"

 

request Id : Result: "{\"message\":\"Request contains invalid parameters.\",\"code\":\"Bad Request\",\"request_id\":\"4dhgkshbkdpueiv0\"}"

3 replies

Forum|alt.badge.img

Hi QA,

I suspect there might be a typo on the attribute key name.

List all templates or just the one your using and check the key value for your recorddateclosed attribute. It might not be what you expect.

For example using postman:

https://{{api.box.com}}/2.0/metadata_templates/enterprise

I get:

{
"id": "548d9254-c7f7-4c34-8898-c9ec1294f705",
"type": "metadata_template",
"templateKey": "customerData",
"scope": "enterprise_877840855",
"displayName": "Customer data",
"hidden": false,
"copyInstanceOnItemCopy": false,

"fields": [
{
"id": "ef2c0822-c134-4221-b40c-3bfb14a59c96",
"type": "string",
"key": "customerName",
"displayName": "Customer Name",
"hidden": false
},

However on the template administration console:

BOX3_anobAQ27lqq09De5WxlaAg.png

The attribute name, which is the display name is not the same as the key name.

Let me know if this helps.


Forum|alt.badge.img

Hi,

An Thank You for the response, i am entering the correct key and the value is string .

this is how i  am adding the value into the metadata that is new Dictionary<string, object>();

                                     var omri = "omri";
                                    var obj =(object) new {omri};
                                    metadataValues.Add(item.Key.ToLower(),obj);

BOX3_85KD0WuiWnnKVfjA2FOx4g.png

BOX3_jSBBCMNi91KhJWAzvmPzWg.png

 

What do you think ?


Forum|alt.badge.img

I have been experiencing the same thing for as long as I can remember and tried million ways to circumvent that problem but still could get anywhere. Did you manage to get that solved qa?