Endpoints

HTTPS

HTTPS requests can be made to https://jsonblob.com. HTTP requests will be 301 redirected to HTTPS, so clients should be configured to follow redirects.

POST /api/jsonBlob

Details

Creating a JSON Blob is accomplished by sending a POST request to /api/jsonBlob. The body of the request should contain valid JSON that will used as the JSON Blob. Upon successfully storing the JSON blob, a 201 response will be returned. The Location header in the response will be set to the URL at which the blob can be accessed with a GET request. The body of the response is the JSON that was stored in the JSON blob.

Example request and response

curl -i -X "POST" -d '{"people":["bill", "steve", "bob"]}' -H "Content-Type: application/json" -H "Accept: application/json" https://jsonblob.com/api/jsonBlob

HTTP/1.1 201 Created
Location: https://jsonblob.com/api/jsonBlob/5226571730043f8b22dadc20
Content-Type: application/json
Transfer-Encoding: chunked

{"people":["bill","steve","bob"]}
                    

In this example, the id of the JSON Blob is 5226571730043f8b22dadc20 (also known as the blobId).

GET /api/jsonBlob/<blobId>

Details

Retrieving a JSON Blob is accomplished by sending a GET request to /api/jsonBlob/<blobId>, where <blobId> is the last part of the URL path returned from the POST request. Upon successfully retrieving the JSON Blob, a 200 response will be returned. If no JSON Blob exists for the given <blobId>, a 404 response will be returned. The body of the response is the JSON that was stored in the JSON Blob.

Example request and response

curl -i -H "Content-Type: application/json" -H "Accept: application/json" https://jsonblob.com/api/jsonBlob/5226571730043f8b22dadc20

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

{"people":["bill","steve","bob"]}
                    

PUT /api/jsonBlob/<blobId>

Details

Updating a JSON Blob is accomplished by sending a PUT request to /api/jsonBlob/<blobId>. The request body should contain valid JSON that the stored JSON Blob will be replaced with. Upon successfully storing the new JSON Blob, a 200 response will be returned. If no JSON Blob exists for the given <blobId>, a 404 response will be returned. The body of the response is the JSON that was stored in the JSON Blob.

Example request and response

curl -i -X "PUT" -d '{"people":["fred", "mark", "andrew"]}' -H "Content-Type: application/json" -H "Accept: application/json" https://jsonblob.com/api/jsonBlob/5226571730043f8b22dadc20

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

{"people":["fred","mark","andrew"]}
                    

DELETE /api/jsonBlob/<blobId>

Details

Deleting a JSON Blob is accomplished by sending a DELETE request to /api/jsonBlob/<blobId>. Upon successfully deleting the JSON Blob, a 200 response will be returned. If no JSON Blob exists for the given <blobId>, a 404 response will be returned. If deleting blobs is not enabled, a 405 response will be returned.

Example request and response

curl -i -X "DELETE" https://jsonblob.com/api/jsonBlob/5226571730043f8b22dadc20

HTTP/1.1 200 OK
                    

Custom URLs

Paths with blob Ids

GET, PUT, and DELETE requests can be customized to support any url path scheme. The only requirement is that the first path part is /api/. For GET, PUT, and DELETE requests, the blobId must be present somewhere as a URL path part following /api/ or the blobId is set in the X-jsonblob header and then you are free to use any URL path as long as the first path part is /api/.

As an example, if we were trying to mimic a RESTful url structure for getting the names of the employees in a company with a particular role, we may use want to use a url like /api/company/<companyId>/employees/engineers"> where 5226571730043f8b22dadc20 is the <companyId> that represents the data the client is expecting.

Example request and response

curl -i  -H "Content-Type: application/json" -H "Accept: application/json" https://jsonblob.com/api/company/5226571730043f8b22dadc20/employees/engineers

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

{"people":["bill","steve","bob"]}
                    

Paths without blob Ids

Additionally, you could make the request using the X-jsonblob header:

Example request and response

url -i  -H "Content-Type: application/json" -H "Accept: application/json" -H "X-jsonblob: 5226571730043f8b22dadc20" https://jsonblob.com/api/company/employees/engineers

HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked

{"people":["bill","steve","bob"]}
                    

© 2017 Tristan Burch