Using the SCHEMA DOCS UPDATE NAME API, you can UPDATE the Schema docs which can be used to validate records if attached to a Collection.
Update Schema Doc
Please refer to Schema Doc - Schema Doc - Update Documentation if you wish to update your Schema Doc & not just the name.
Root
https://api.jsonbin.io/v3
Route
/s/<SCHEMA_DOC_ID>
Request Type
PUT
Request Headers
Header | Value | Required |
Content-Type | application/json | Yes |
X-Master-Key | <YOUR_SECRET_KEY> | Yes |
X-Schema-Doc-Name | <SCHEMA_DOC_NAME> | Yes |
Content-Type
Content-Type needs to be set to application/json. The request will result in an error in-case of a missing Content-Type header.
X-Master-Key
X-Master-Key is required to Update a Schema Doc. You can find your X-Master-Key on the API Keys page after signing-in.
X-Schema-Doc-Name
X-Schema-Doc-Name is required to Name your Schema Doc. You can set a name no more than 32 characters.
Basic Code Samples
curl -v\
-H "X-Schema-Doc-Name: New Name" \
-H "X-Master-Key: <YOUR_API_KEY>" \
--request PUT \
https://api.jsonbin.io/v3/s/<SCHEMA_DOC_ID>
let req = new XMLHttpRequest();
req.onreadystatechange = () => {
if (req.readyState == XMLHttpRequest.DONE) {
console.log(req.responseText);
}
};
req.open("PUT", "https://api.jsonbin.io/v3/s/<SCHEMA_DOC_ID>", true);
req.setRequestHeader("X-Schema-Doc-Name", "New Name");
req.setRequestHeader("X-Master-Key", "<YOUR_API_KEY>");
req.send();
import requests
url = 'https://api.jsonbin.io/v3/s/<SCHEMA_DOC_ID>'
headers = {
'X-Schema-Doc-Name': 'New Name',
'X-Master-Key': '<YOUR_API_KEY>'
}
data = {}
req = requests.put(url, json=data, headers=headers)
print(req.text)
require 'net/http'
require 'json'
uri = URI("https://api.jsonbin.io/v3/s/<SCHEMA_DOC_ID>")
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
req = Net::HTTP::Put.new(uri)
req['X-Schema-Doc-Name'] = 'New Name'
req['X-Master-Key'] = '<YOUR_API_KEY>'
req.body = {}.to_json
http.request(req)
end
puts res.body
Request Response
Success 200
{
"record":{
<SCHEMA_VALIDATION_JSON>
},
"metadata": {
"id":"<SCHEMA_DOC_ID>",
"name": "User Validation",
"createdAt": <DATE/TIME>
}
}
Error 400, 401, 403
{
"message": "<ERROR_MESSAGE>"
}
Status Code | Error Message |
---|---|
401 Unauthorized |
You need to pass X-Master-Key in the header |
400 Bad Request |
You need to pass X-Schema-Doc-Name header to set a name for the Schema Doc |
400 Bad Request |
X-Schema-Doc-Name cannot be blank |
400 Bad Request |
Name of the Schema Doc cannot be above 32 characters |
400 Bad Request |
Invalid Schema Id provided |
400 Bad Request |
Invalid X-Master-Key provided |
403 Forbidden |
Requests exhausted. Buy additional requests at https://jsonbin.io/pricing |
404 Not Found |
Schema Doc not found |