Cannot upload file without ClientModified. Dropbox API return "500 Internal server error"
package main
import (
"encoding/json"
"fmt"
"time"
)
type StringStruct struct {
Val string `json:"val,omitempty"`
}
type IntStruct struct {
Val int `json:"val,omitempty"`
}
type TimeStruct struct {
Val time.Time `json:"val,omitempty"`
}
func main() {
{
a := &StringStruct{}
b, _ := json.Marshal(a)
fmt.Println(string(b))
}
{
a := &IntStruct{}
b, _ := json.Marshal(a)
fmt.Println(string(b))
}
{
a := &TimeStruct{}
b, _ := json.Marshal(a)
fmt.Println(string(b))
}
}
{}
{}
{"val":"0001-01-01T00:00:00Z"}
$ curl -i -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer <my-token>" \
--header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"add\",\"mute\": false, \"client_modified\":\"0001-01-01T00:00:00Z\"}" \
--header "Content-Type: application/octet-stream" \
--data-binary @local_file.txt
HTTP/1.1 500 Internal Server Error
Server: nginx
Date: Fri, 13 Jan 2017 16:20:38 GMT
Content-Type: text/plain; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Dropbox-Request-Id: 0b2875fd8a0069a1791d5517d5c3f44f
X-Robots-Tag: noindex, nofollow, noimageindex
$ curl -i -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer <my-token>" \
--header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"add\",\"mute\": false, \"client_modified\":\"2001-01-01T00:00:00Z\"}" \
--header "Content-Type: application/octet-stream" \
--data-binary @local_file.txt
HTTP/1.1 409 path/conflict/file/
Server: nginx
Date: Fri, 13 Jan 2017 16:21:14 GMT
Content-Type: application/json
Transfer-Encoding: chunked
Connection: keep-alive
X-Dropbox-Request-Id: fa466b7446442dfef16521036c59e089
X-Robots-Tag: noindex, nofollow, noimageindex
{"error_summary": "path/conflict/file/", "error": {".tag": "path", "reason": {".tag": "conflict", "conflict": {".tag": "file"}}, "upload_session_id": "AAAAAAAADm1RHB9OZkctbw"}}
Before 2017 Jan 04, if client_modified is "0001-01-01T00:00:00Z", it works.
After 2017 Jan 04, if client_modified is "0001-01-01T00:00:00Z", it return 500 internal server error.
Maybe dropbox modify their API.
I don't know which solution do you like. I can't make pull request. So I make issue.