Update file
import requests
url = "https://api.datagrid.com/v1/files/{file_id}"
payload = { "expires_after": 259200 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expires_after: 259200})
};
fetch('https://api.datagrid.com/v1/files/{file_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://api.datagrid.com/v1/files/{file_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_after": 259200
}
'{
"object": "file",
"id": "<string>",
"filename": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"media_type": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"credits": {
"consumed": 123
}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Files
Update file
Update file metadata.
PATCH
/
files
/
{file_id}
Update file
import requests
url = "https://api.datagrid.com/v1/files/{file_id}"
payload = { "expires_after": 259200 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({expires_after: 259200})
};
fetch('https://api.datagrid.com/v1/files/{file_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://api.datagrid.com/v1/files/{file_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_after": 259200
}
'{
"object": "file",
"id": "<string>",
"filename": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"media_type": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"credits": {
"consumed": 123
}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Authorizations
Body
application/json
Response
Updated file
The File object represents a document that has been uploaded to Datagrid.