2
votes

I am trying to write a C# application using the Box API, but I have trouble creating a folder using the v2 API. .NET does not natively support JSON, therefore I am trying to send the request to

https://upload.box.com/api/2.0/folders/{0}.xml

(this way the response will be XML formatted and easy to parse from C#).

The problem is, I am not sure how to format the POST request body, since the v2 documentation does not state this information.

Any help would be greatly appreciated.

1

1 Answers

0
votes

For creating a folder in JSON you would POST /folders/{folder id} with a body of

{
    "name": "the new folder's name"
}

The XML version is essentially the same, except you wrap everything with <body> instead of curly braces i.e.

<body>
    <name>something</name>
</body>

(As a sidenote, it appears that there's a bug with the .xml extension. For now you can get XML by appending ?response_type=xml)