The Dragpad API
The Dragpad API can be used to access and change the data stored within our application from outside the site. This allows other developers to create applications which interface with Dragpad.
Accessing the API
The API can be accessed from the URL http://www.dragpad.com/api/v1.
In order to gain access to the API, you must retrieve an API key for your account and provide it in the request to the API in the form of a GET request named 'apikey'.
An API key for your account can be retrieved from the settings page. Therefore, the base request to the API must take the form:
http://www.dragpad.com/api/v1?apikey=<your api key>
Successful requests
If whatever request you make is successful, you will receive a response from the API in the JSON (Javascript Object Notation) data interchange format.
Errors
If whatever request you make is unsuccessful, you will receive an error message from the API in the JSON (Javascript Object Nototation) data interchange format with 'errorMsg' as a property of the returned object.
Retrieving objects
Get all the sites that you contribute to
URL: http://www.dragpad.com/api/v1/sites/findall?apikey=<your api key>
Will return: An array of Site objects that you contribute to
Get all the pages from a site that you contribute to
URL: http://www.dragpad.com/api/v1/sites/sitepages/findall?apikey=<your api key>&site=<site slug>
Will return: An array of Site Page objects from the specified site in the GET request
Get all the contributing users from a site that you contribute to
URL: http://www.dragpad.com/api/v1/sites/users/findall?apikey=<your api key>&site=<site slug>
Will return: An array of User objects from the specified site in the GET request
Adding objects
Add a site
URL: http://www.dragpad.com/api/v1/sites/add?apikey=<your api key>
Will return: A notification that the site has been added
Expects: One POST request named 'siteName'.
Add a site page
URL: http://www.dragpad.com/api/v1/sites/sitepages/add?apikey=<your api key>&site=<site slug>
Will return: A notification that the site page has been added
Expects: One POST request named 'sitePageName'.
Add a user as a contributer to a site
URL: http://www.dragpad.com/api/v1/sites/users/add?apikey=<your api key>&site=<site slug>
Will return: A notification that the user has been added as a contributer
Expects: One POST request named 'userName'.
Editing objects
Rename a site
URL: http://www.dragpad.com/api/v1/sites/rename?apikey=<your api key>&site=<site slug>
Will return: A notification that the site has been renamed
Expects: One POST request named 'newSiteName'.
Rename a site page
URL: http://www.dragpad.com/api/v1/sites/sitepages/rename?apikey=<your api key>&site=<site slug>&sitepage=<site page slug>
Will return: A notification that the site page has been renamed
Expects: One POST request named 'newSitePageName'.
Deleting objects
Delete a site
URL: http://www.dragpad.com/api/v1/sites/delete?apikey=<your api key>&site=<site slug>
Will return: A notification that the site has been deleted
Delete a site page
URL: http://www.dragpad.com/api/v1/sites/sitepages/delete?apikey=<your api key>&site=<site slug>&sitepage=<site page slug>
Will return: A notification that the site page has been deleted
Remove a contributing user from a site
URL: http://www.dragpad.com/api/v1/sites/users/remove?apikey=<your api key>&site=<site slug>&username=<username>
Will return: A notification that the user has been removed as a contributer from the specified site
Saving data
Saving HTML/CSS to a page
URL: http://www.dragpad.com/api/v1/sites/sitepages/save?apikey=<your api key>&site=<site slug>&sitepage=<site page slug>
Will return: A notification that the page has been saved
Expects: Two POST requests named 'sitePageHTML' and 'sitePageCSS'.
