<a id="versioning-prerelease-and-production"></a>
<a id="api-versioning"></a>
# Versioning, Prerelease and Production

<a id="versioning"></a>
## Versioning

The API is versioned; the version number must be included in the API URLs.

For example, to retrieve the list of Drafts using version 2 of the API:

```
https://www.trialgrid.io/api/v2/drafts/
```

The list of Drafts will be returned in JSON format and includes the Draft ID which will be needed in requests for other Draft objects:

```json
{
"count": 3,
"next": "http://www.trialgrid.io/api/v2/drafts/",
"previous": null,
"results": [
    {
        "id": 999,
        "DraftName": "001 DRAFT",
        "Project": "Project 1"
    },
    {
        "id": 2130,
        "DraftName": "Draft 2",
        "Project": "Project 1"
    },
    {
        "id": 2404,
        "DraftName": "v0.1",
        "Project": "Test Project"
    },
    ]
}
```

The current supported versions are:

> - v1
> - v2

<a id="prerelease-and-production-sites"></a>
## Prerelease and Production sites

Requests to TrialGrid prerelease should have a domain of `prerelease.trialgrid.io`:

```
https://prerelease.trialgrid.io/api/v2/drafts/
```

Requests to TrialGrid production should have a domain of `www.trialgrid.io`:

```
https://www.trialgrid.io/api/v2/drafts/
```
