Can POST /resources allow user_created_time to be set?

I discovered awhile ago that the Resource POST API allows me to set the resource id and title which is great as that's a key feature for my plugin Plugin: Attaché hooray!

I had been assuming (dangerous I know!) that it would also allow me to set the "user_created_time" given the Resources documentation says "When the resource was created. It may differ from created_time as it can be manually set by the user."

However I can't seem to set it on POST??
I've found I can use PUT /resources to set the value so I can achieve what I need, however it would be nice to be able to set this value on create instead of needing an update simply to set one additional attribute.

Replication steps
Step 0) make sure Joplin is running with Web Clipper Service active
Shown below as MY_TOKEN for ease of replication.

Step 1) use normal Joplin desktop UI to insert an attachment "test.png". Shown below as RESOURCE_ID for ease of replication. No space between ] and ( of course.

e.g. ![test.png] (:/RESOURCE_ID)

Step 2) delete the attachment/resource via terminal/command prompt/etc:

curl -X DELETE "http://localhost:41184/resources/RESOURCE_ID?token=MY_TOKEN"

Step 3) insert the attachment/resource via terminal/command prompt attempting to set the resource id, title, and user_created_time.

curl -X POST -F 'data=@/Users/blah/Desktop/test.png' -F 'props={"id":"RESOURCE_ID", "title":"test.png", "user_created_time":"1640062082755"}' "http://localhost:41184/resources?token=MY_TOKEN"

Note, only the id and title are set, the user_created_time is the same as the created_time:

{"id":"RESOURCE_ID","title":"test.png","mime":"image/png","filename":"","created_time":1640498007714,"updated_time":1640498007714,"user_created_time":1640498007714,"user_updated_time":1640498007714,"file_extension":"png","encryption_cipher_text":"","encryption_applied":0,"encryption_blob_encrypted":0,"size":813521,"is_shared":0,"share_id":"","master_key_id":"","type_":4}%

Step 4 I would prefer to avoid) update the attachment/resource via terminal/command prompt using the resource id and set the user_created_time:

curl -X PUT -F 'props={"user_created_time":"1640062082755"}' "http://localhost:41184/resources/RESOURCE_ID?token=MY_TOKEN"

{"id":"RESOURCE_ID","title":"test.png","mime":"image/png","filename":"","created_time":1640498007714,"updated_time":1640498007714,"user_created_time":1640062082755,"user_updated_time":1640500021285,"file_extension":"png","encryption_cipher_text":"","encryption_applied":0,"encryption_blob_encrypted":0,"size":813521,"is_shared":0,"share_id":"","master_key_id":"","type_":4}%

1 Like

UPDATE: my latest plugin update contains my workaround as detailed above (using an additional PUT to perform the update).
Still interested in principle if this is possible though.

1 Like