Docs Index

Doc

POST /api/pads

Create a new pad. You can set some initial conditions as well.

curl \ --data title="Rob Zombie's Interview" \ --data language="ruby" \ --data contents="print 'Hello, World'" \ -H 'Authorization: Token token="<%= api_key %>"' \ https://app.coderpad.io/api/pads
Code language: JavaScript (javascript)

returns

{ "status": "OK", "id": "AFQ2K9A3", "title": "Rob Zombie's Interview", "owner_email": "fbueller@gmail.com", "language": "ruby", "participants": ["vincent"], "contents": "print 'Hello, World'", "notes": "", "events": [], "private": false, "execution_enabled": true, "created_at": "2014-11-14T03:02:45Z", "updated_at": "2014-11-14T03:02:45Z", "ended_at": null, "url": "https://coderpad.io/AFQ2K9A3", "playback": "https://app.coderpad.io/AFQ2K9A3/playback", "history": "https://coderpad.firebaseio.com/AFQ2K9A3/history.json" }
Code language: JSON / JSON with Comments (json)

The available parameters you have to configure are detailed below:

ParameterValues
titleDefaults to “Untitled Pad [ID]”.
languageDefaults to the account default language, which in turn defaults to plaintext.
contentsInitial contents of pad. Defaults to the example code for the language. Note: If you set contents, then you can’t set a question_id or the API will return an error.
question_idQuestion to associate with this pad. When you set this, it behaves similarly as if you created a pad from a question on the website: the question language becomes the new pad’s language, and question contents become the pad’s contents. Note: If you set question_id, then you can’t set contents or the API will return an error.
privateDefaults to the account default privacy setting, which in turn defaults to false.
execution_enabledDefaults to the account default execution setting, which in turn defaults to true.
user_emailThe email of the user to set as the owner of this pad, e.g. "vincent@coderpad.io". This parameter can only be set by owners of the organization. This will also create a user account if necessary, as long as the email is a valid one for your organization.

This method can return a quota exceeded error if you are over your used pad limit for the month.