Skip to main content
Question

file lock unlock syntax

  • May 22, 2025
  • 1 reply
  • 25 views

Forum|alt.badge.img

Hii
i'm using this call to get the lock status of a file::

curl -X GET 'https://api.box.com/2.0/files//906429515962?fields=lock,name'  -H 'Authorization: Bearer redacted'

I get that:

{|id|:"906429515962", etag:"0", type:"file", lock:missing value, |name|:"Photo.png"}

 

which is good for me

 

I  tried the files endpoint and upload endpoints

and got no valid results

 

What is the syntax?

Thanks

BTW locking of the app file in contents folder seems impossible (upgrade is mentionned)  why?

 

 

 

 

1 reply

Forum|alt.badge.img

found

 

syntax to reset lock and set lock and return values

 

  curl -i -X PUT "https://api.box.com/2.0/files/90798774786421245" \
     -H "Authorization: Bearer redacted" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "brugeron6.indd", 
       "lock":{"access":"lock"}
     }'

{"type":"file","id":"907987747864","file_version":{"type":"file_version","id":"977967003064","sha1":"c358d3f0dd56dec732435bb2142a67729ffefc93"},"sequence_id":"8","etag":"8","sha1":"c358d3f0dd56dec732435bb2142a67729ffefc93","name":"brugeron6.indd","description":"","size":1232896,"path_collection":{"total_count":1,"entries":[{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"Tous les fichiers"}]},"created_at":"2022-01-19T08:52:29-08:00","modified_at":"2022-01-30T09:09:15-08:00","trashed_at":null,"purged_at":null,"content_created_at":"2022-01-17T10:49:34-08:00","content_modified_at":"2022-01-17T10:49:34-08:00","created_by":{"type":"user","id":"18339283899","name":"Christian Brugeron","login":"Christian.Brugeron@x.com"},"modified_by":{"type":"user","id":"18339283899","name":"Christian Brugeron","login":"Christian.Brugeron@x.com"},"owned_by":{"type":"user","id":"18339283899","name":"Christian Brugeron","login":"Christian.Brugeron@redacted.com"},"shared_link":null,"parent":{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"Tous les fichiers"},"item_status":"active"}% 

  curl -i -X PUT "https://api.box.com/2.0/files/907987747864" \
     -H "Authorization: Bearer redacted" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "test.inbd", 
       "lock":null
     }'

{"type":"file","id":"907987747864","file_version":{"type":"file_version","id":"977967003064","sha1":"c358d3f0dd56dec732435bb2142a67729ffefc93"},"sequence_id":"9","etag":"9","sha1":"c358d3f0dd56dec732435bb2142a67729ffefc93","name":"brugeron5.inbd","description":"","size":1232896,"path_collection":{"total_count":1,"entries":[{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"Tous les fichiers"}]},"created_at":"2022-01-19T08:52:29-08:00","modified_at":"2022-01-30T09:17:22-08:00","trashed_at":null,"purged_at":null,"content_created_at":"2022-01-17T10:49:34-08:00","content_modified_at":"2022-01-17T10:49:34-08:00","created_by":{"type":"user","id":"18339283899","name":"Christian Brugeron","login":"Christian.Brugeron@x.com"},"modified_by":{"type":"user","id":"18339283899","name":"Christian Brugeron","login":"Christian.Brugeron@x.com"},"owned_by":{"type":"user","id":"18339283899","name":"Christian Brugeron","login":"Christian.Brugeron@x.com"},"shared_link":null,"parent":{"type":"folder","id":"0","sequence_id":null,"etag":null,"name":"Tous les fichiers"},"item_status":"active"}%