Update a File
1 min
code examples curl request put \\ \ url https //developer digitail io/api/v1/files/{id} \\ \ header 'accept application/json'var myheaders = new headers(); myheaders append("accept", "application/json"); myheaders append("content type", "application/json"); var requestoptions = { method 'put', headers myheaders, redirect 'follow' }; fetch("https //developer digitail io/api/v1/files/{id}", requestoptions) then(response => response text()) then(result => console log(result)) catch(error => console log('error', error));require "uri" require "json" require "net/http" url = uri("https //developer digitail io/api/v1/files/{id}") https = net http new(url host, url port) https use ssl = true request = net http put new(url) request\["accept"] = "application/json" request\["content type"] = "application/json" response = https request(request) puts response read body import requests import json url = "https //developer digitail io/api/v1/files/{id}" payload = {} headers = { 'accept' 'application/json', 'content type' 'application/json' } response = requests request("put", url, headers=headers, data=payload) print(response text) responses // successful operation { "data" { "id" 1, "pet id" 1, "clinic id" 766, "file id" 0, "name" "image jpg", "name without extension" "image", "extension" "jpg", "thumbnail" "https //vet digitail io/images/files/jpg svg", "updated at" "2021 10 05t12 52 53 000000z", "download url" "https //vet digitail io/api/v1/files/1/download", "preview url" "https //vet digitail io/api/v1/files/1/preview" } }// the request was invalid or contained data that was not allowed { "message" "requested filter(s) `filter1` are not allowed allowed filter(s) are date, query, " }// the authorization token is missing or invalid // the user is not authorized to perform the requested operation // this response is sent when a request fails validation the format is identical on all endpoints { "message" "the name field is required (and 1 more error)", "errors" { "field1" \[ "" ], "field2" \[ "" ] } }// the user has sent too many requests in a given amount of time ("rate limiting") max 200 requests per minute