JS Bin API
JS Bin’s API comes in a few flavours.
- Get data
- Post data for pro user accounts (to be detailed)
Read API
Write API
A simple REST based API exists for anonymous users if it is enabled in your config.*.json, or can be restricted to registered users with a key specified in ownership.api_key
Authentication is required for all API requests unless one of the following api configuration options are set:
api.allowAnonymousReadWrite
- if set to true allows GET and POST operations to the API anonymously (without an API key)api.allowAnonymousRead
- if set to true allows GET operations to the API anonymously (without an API key)
By default, config.default.json
has api.allowAnonymousRead
set to true.
Curl authentication examples:
$ curl http://{{host}}/api/:bin -H "Authorization: token {{token_key}}"
$ curl http://{{host}}/api/:bin?api_key={{token_key}}
End points are:
GET /api/:bin
- Retrieve the latest version of the bin with that specified IDGET /api/:bin/:rev
- Retrieve the specific version of the bin with the specified ID and revisionPOST /api/save
- Create a new bin, the body of the post should be URL encoded and containhtml
,javascript
andcss
parametersPOST /api/:bin/save
- Create a new revision for the specified bin, the body of the post should be URL encoded and containhtml
,javascript
andcss
parameters
❤️ Love JS Bin?
Support this open source project today, and help it continue to run for another decade 🎂