Update Schema Docs Name API

You could use the Update Schema Docs Name API to update the Name of the Schema Docs you've created or attached to any collection.

Note: Refer to Schema Docs Update API Documentation if you wish to update your Schema Doc and not just the name.

Root

https://api.jsonbin.io/v3 

Route

/s/<SCHEMA_DOC_ID> 

Request Type

PUT

Request Headers

Below are the list of Accepted Request Headers if you are trying to Read a Schema Doc.

Request Header Value Required
Content-Type application/json Yes
X-Master-Key <X-Master-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 Required

X-Master-Key is nothing but your Core API Access Key. You will need this Key to access mostly any API end-point on JSONBin. You could find the key on the API Keys page.

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.

Code Samples

  • cURL
  • JavaScript (ES6)
  • Python 3
  • Ruby
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 Status Code: 200
{
  "record":{
    <SCHEMA_VALIDATION_JSON>
  },
  "metadata": {
    "id": "<SCHEMA_DOC_ID>",
    "name": "User Validation",
    "createdAt": <DATE / TIME>
  }
}
Error Status Code: 400, 401, 403, 404
{
  "message": "<Error Message>"
}

For more information on the error codes & errors you might possibly encounter, refer to the below section.

Error Reference

  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
You need to pass X-Schema-Doc-Name header to set a name for the Schema Doc

You'll face this error if you are not passing X-Schema-Doc-Name header to update the name for the Schema Doc created.

X-Schema-Doc-Name cannot be blank

As the error message says, you need to pass a name for your Schema Doc.

Name of the Schema Doc cannot be above 32 characters

You'll face the above error if you have passed a long name for your Schema Doc which is above 32 characters.

Invalid Schema Id provided

Check the Schema Doc Id you've passed. You may face this issue if the ID is invalid or the ID doesn't belong to your account.

You need to pass X-Master-Key in the header

You'll encounter this error if you are not passing the X-Master-Key header which is required to authenticate your request while creating Schema Docs or you've passed an incorrect key. In-order to fix this, pass the X-Master-Key header with a value of the API Key which you can find on the API Keys page.

Invalid X-Master-Key provided

You'll faec this error when the X-Master-Key is passed but the ID isn't valid.

Requests exhausted. Buy additional requests at https://jsonbin.io/pricing

You'll face this error when you've exhausted all your requests.

Schema Doc not found

Make sure you pass the correct Schema Doc ID or the Schema Doc doesn't belong to your account.

Create a Free Account

Create an Account View Pricing