Content API

The Content API handles everything with submitting and retrieving content requests. This is what is used for both sending jobs for localizing and for creating new content.

Create new request

Submit a new content request for either localization or creation. For details about the format see the section on Content Requests.

PUT /v1/content
Headers
Authorization: Bearer your-token-here
Content-Type: application/json
Body
{
    "language": {
        "source": "sv",
        "target": "en"
    },
    "fields": [
        {
            "id": "body",
            "type": "localizable",
            "data": "html",
            "value": "<p>Denna text kan innehålla <strong>HTML taggar</strong></p>"
        }
    ]
}
Response 200 OK
{
    "id": "generated-unique-id",
    "state": "pending",
    "created": "2016-02-23T09:02:08.22Z",
    "fields": [
    ]
}
Response 400 Bad Request

If an invalid content request is sent, either with no data or if data is missing.

{
    "state": "invalid",
    "errors": [
        "..."
    ]
}
Response 403 Forbidden

If no authorization header is sent or if the header is not on the form Bearer your-token-here or if the token is invalid.

Get status for a single request

GET /v1/content/request/:id
Parameters
Name Type Description
:id string Id as returned when request was submitted
Headers
Authorization: Bearer your-token-here
Response 200 OK
{
    "id": "{id}",
    "state": "complete",
    "created": "2016-02-23T09:02:08.22Z",
    "completed": "2016-02-26T11:05:43.40Z",
    "language": {
        "source": "sv",
        "target": "en"
    },
    "fields": [
        {
            "id": "body",
            "type": "localizable",
            "data": "html",
            "value": "<p>This text can contain <strong>HTML tags</strong></p>",
            "originalValue": "<p>Denna text kan innehålla <strong>HTML taggar</strong></p>"
        }
    ]
}
Response 403 Forbidden

If no authorization header is sent or if the header is not on the form Bearer your-token-here or if the token is invalid.

Query content

Query for content requests that have been previously submitted optionally limiting the returned requests based on state and completion date.

GET /v1/content?page=2&state=pending&from=2016-02-29T00:00:00.00Z
Parameters
Name Type Description
page string (optional) Page number to paginate through results
state enum (optional) The state that returned requests needs. Defaults to any state. Can be pending, confirmed or completed.
from RFC3339 datetime (optional) The minimum datetime that a content request should have been completed. Default is to not filter on from date.
Headers
Authorization: Bearer your-token-here
Response 200 OK
{
    "page": 1,
    "pages": 3,
    "total": 23,
    "requests": [
        {
            "id": "generated-unique-id",
            "state": "complete",
            "created": "2016-02-23T09:02:08.22Z",
            "completed": "2016-02-26T11:05:43.40Z",
            "language": {
                "source": "sv",
                "target": "en"
            },
            "fields": [
                {
                    "id": "body",
                    "type": "localizable",
                    "data": "html",
                    "value": "<p>This text can contain <strong>HTML tags</strong></p>",
                    "originalValue": "<p>Denna text kan innehålla <strong>HTML taggar</strong></p>"
                }
            ]
        },
        ...
    ]
}
Response 400 Bad Request

If any of the parameters are invalid.

Response 403 Forbidden

If no authorization header is sent or if the header is not on the form Bearer your-token-here or if the token is invalid.

results matching ""

    No results matching ""