API - Upload File - Specify content_modified_at :: not a valid rfc 3339 formatted date
回答済みCan someone please point out where this is going wrong? I have tried formatting this date in many ways and continue to get an error that it is invalid. Looking at the documentation reference this should be accepted.
Objective:
I have a file, when it uploads to box I would like the modified time to represent the actual date the file was modified and NOT when it was uploaded to Box.
Code:
{"name":"test.df2","parent":{"id":***phone number removed for privacy***"},"content_modified_at":"2016-08-12T15:22:20-04:00"}
Error:
Invoke-RestMethod : {"type":"error","status":400,"code":"bad_request","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"not a valid rfc 3339 formatted
date","request_id":"***number removed for privacy***0598b1b1bb56d7"}
At line:56 char:24
+ ... load_file = Invoke-RestMethod -Uri 'https://upload.box.com/api/2.0/fi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Documentation:
All timestamps (both those sent in requests and those returned in responses) should be formatted as shown in our examples. We support RFC 3339 timestamps. The preferred way to pass in a date is by converting the time to UTC such as this: 2013-04-17T09:12:36-00:00.
In cases where timestamps are rounded to a given day, you may omit the time component. So instead of 2013-04-17T13:35:01+05:00 you can use 2013-04-17. If a time (and not just a date) however, is specified in a request then the calendar date in the Pacific timezone at the moment specified is the day that is accepted.
Box supports the subset of dates after the start of the Unix epoch: 1970-01-01T00:00:00+00:00 (00:00:00 UTC on January 1, 1970).
As a note, the timestamp you receive from the Box API is based on the settings in the Admin console. If you are a part of an enterprise, it will be the default user settings set by your admin.
The name of the file
The ID of the parent folder. Use "0" for the root folder.
The creation date of the file. See content times for formatting.
The last modification date of the file
-
Both the modified_at and content_modified_at fields are read-only. The workaround for your use case is creating a custom metadata field on the file and storing this information in that field. I realize this was unclear in our documentation, and I just added a note to the file object section in our reference docs to explain this.
サインインしてコメントを残してください。
コメント
1件のコメント