0
votes

I'm trying to upload a file via Box API and I want to specify the content_modified_at parameter. However, I always receive an error in response, saying that I specify the date not in ISO 8601 format. I double-checked the format I'm sending, and it's definitely ISO 8601.

If I don't specify this field, the file is created successfully.

The field in my request has format "2013-04-21T19:39:16+03:00", and I'm not sure how this is different from "2012-12-12T11:04:26-08:00" that is used in Box API docs

Here is the full listing of my request and response:

-------------- REQUEST  --------------
POST https://upload.box.com/api/2.0/files/content
Accept-Encoding: gzip
Authorization: Bearer [hidden]
User-Agent: Google-HTTP-Java-Client/1.14.1-beta (gzip)
Content-Type: multipart/form-data; boundary=__END_OF_PART__

--__END_OF_PART__
Content-Type: application/octet-stream
content-disposition: form-data; name="filename"; filename="file1.txt"

1234567890

--__END_OF_PART__
content-disposition: form-data; name="parent_id"

760503410
--__END_OF_PART__
content-disposition: form-data; name="content_modified_at"

2013-04-21T19:39:16+03:00
--__END_OF_PART__--

-------------- RESPONSE --------------
HTTP/1.1 400 Bad Request
Date: Sun, 21 Apr 2013 17:01:23 GMT
Content-Length: 193
X-Error-Handling: entry;index.php|rid;132352423451741b638d902|runmode;box_api_v2|user;2|user;193761140|
Connection: close
Content-Type: application/json
Server: Apache/2.2.15 (Scientific Linux)
Cache-Control: no-cache, no-store

{"type":"error","status":400,"code":"bad_request","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"not a valid iso 8601 formatted date","request_id":"132352423451741b638d902"}

UPDATE: Does anybody of the Box team actually care about this? Does it mean there is a mistake in the services or just nobody wants to explain me what was my fault?

1
Will it succeed if you create the file without it, and then update the file information to include it? This might help to isolate the problem to either an API or a formatting issue.John Hoerr
@JohnHoerr This is what I was doing from the very beginning. I was creating a file via API or manually, then running the test and it was failing with this exception. When I remove the optional "content_modified_at" field from my request, then file is uploaded successfully. I receive the same result, when I specify this field for "new file upload" request.afrish
I don't think I stated that clearly. Let me try again: are you able to to set the content_modified_at property on an existing file?John Hoerr
@JohnHoerr The only way to update a field of existing file I see now is described here developers.box.com/docs/#files-update-a-files-information. Unfortunately, there is no content_modified_at or simply modified_at field in the list of allowed fields for update. However, there is one field unshared_at that has timestamp type. I can successfully update this field via this REST method using exactly the same date-time format as I use for content_modified_at.afrish
You're right -- my mistake, sorry!John Hoerr

1 Answers

0
votes

There is an issue with our time stamp parser that we're in the process of fixing.

You should see now issues if you set the timestamp to UTC and send it with a timezone offset of -00:00, e.g.

2013-04-17T09:12:36-00:00

Again, this is an issue on our end that we're working on resolving.