REST API
Developer reference for the Ascender API.
This guide applies to the latest version of Ascender only. The content in this guide is updated frequently and might contain functionality that is not available in previous versions. Likewise content in this guide can be removed or replaced if it applies to functionality that is no longer available in the latest version.
You can find lots of Ascender discussion and get answers to questions at the Ascender Discussion Forum.
The REST API guide covers the following topics:
- This page: Tools, the Browsable API, and API Conventions
- Querying the API: sorting, searching, filtering, pagination, and read-only fields
- Access resources
- Authentication methods
Tools
This document offers a basic understanding of the REST API used by Ascender.
REST stands for Representational State Transfer and is sometimes spelled as "ReST". It relies on a stateless, client-server, and cacheable communications protocol, usually the HTTP protocol.
You may find it helpful to see which API calls the user interface makes in sequence. To do this, you can use the UI from Firebug or Chrome with developer plugins.
Another alternative is Charles Proxy, which offers a visualizer that you may find helpful. While it is commercial software, it can insert itself as an OS X proxy, for example, and intercept both requests from web browsers as well as curl and other API consumers.
Other alternatives include:
Browsable API
REST APIs provide access to resources (data entities) via URI paths. You can visit the Ascender REST API in a web browser at: http://<server name>/api/

Ascender supports version 2 of the API, which can be accessed by clicking the v2 link next to "current versions" or "available versions":

If you perform a GET just the /api/ endpoint, it gives the current_version, which would be the recommended version.
Clicking on various links in the API allows you to explore related resources.

Clicking on the ? (question mark) icon next to the page name (toward the top of the screen) for an API endpoint gives you documentation on the access methods for that particular API endpoint and what data is returned when using those methods.
You can also use PUT and POST verbs on the specific API pages by formatting JSON in the various text fields.

You can also view changed settings from factory defaults at /api/v2/settings/changed/ endpoint. It reflects changes you made in the API browser, not changed settings that come from static settings files.

Conventions
Ascender uses a standard REST API, rooted at /api/ on the server. The API is versioned for compatibility reasons, and currently api/v2/ is the latest available version. You can see information about what API versions are available by querying /api/.
You may have to specify the content/type on POST or PUT requests accordingly.
- PUT: Update a specific resource (by an identifier) or a collection of resources. PUT can also be used to create a specific resource if the resource identifier is known before-hand.
- POST: Create a new resource. Also acts as a catch-all verb for operations that do not fit into the other categories.
All URIs not ending with "/" receive a 301 redirect.
Formatting of extra_vars attached to Job Template records is preserved. YAML is returned as YAML with formatting and comments preserved, and JSON is returned as JSON.