Skip to content
Philipp Wolfer edited this page May 14, 2013 · 9 revisions

POST /project/{projectId}/jobs

Request: POST /project/{projectId}/jobs

Creates a new job with the state new for the project specified by projectId and returns the result in the response body. You can only add jobs to projects in the state prepared.

When creating a new job you can set the following attributes:

  • name: The job name (required, can be any non-empty string).
  • source_language: The ISO 639 language code of the source language (required).
  • target_language: The ISO 639 language code of the target language (required).
  • quality: The type of translation, can be either translation or translation-and-correction (required).
  • topic: Any topic ID
  • briefing: A string containing further briefing information for the job.
  • is_active: A boolean flag indicating whether this job is active or not. Inactive jobs will be ignored when the project is started and will not get translated. Default true.

Request headers

Header Description
Authorization oAuth 2 authentication header
Accept application/json or application/xml
Content-Type The content type of the posted data (application/json or application/xml)

Response status codes

HTTP status Description
201 Created The job was successfully created, the Content-Location header contains the URI of the created job.
400 Bad Request The input data was incomplete or contained errors.
403 Forbidden You are not allowed to update the job, e.g. when the project’s state is not prepared.
404 Not Found The corresponding project with the given ID does not exist.

Example

Add a new job for German to English translation to the project with the ID bc141454-5949-401b-9c05-7591ee2f5624. The job should be translated and corrected and has the topic “General”.

POST /v1/project/bc141454-5949-401b-9c05-7591ee2f5624/jobs HTTP/1.1
Host: api.textking.com
Accept: application/json
Content-Type: application/json
Authorization: Bearer youraccesstoken

{
    "name": "My new translation job DE -> EN",
    "source_language": "de",
    "target_language": "en",
    "quality": "translation-and-correction",
    "topic": "49353ab0-fdbf-4e1c-a063-cdf4aad98782",
    "briefing": "Some remarks for the translator",
    "is_active": true,
}

Response:

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
Location: https://api.textking.com/v1/project/bc141454-5949-401b-9c05-7591ee2f5624/job/3bfaa57a-7385-4fec-ae1a-ba2c6bea5679
Content-Location: https://api.textking.com/v1/project/bc141454-5949-401b-9c05-7591ee2f5624/job/3bfaa57a-7385-4fec-ae1a-ba2c6bea5679

{
    "id": "3bfaa57a-7385-4fec-ae1a-ba2c6bea5679",
    "number": null,
    "name": "My new translation job DE -> EN",
    "source_language": "de",
    "target_language": "en",
    "quality": "translation",
    "topic": "49353ab0-fdbf-4e1c-a063-cdf4aad98782",
    "briefing": "Some remarks for the translator",
    "state": "new",
    "words": null,
    "net_price": null,
    "currency": null,
    "is_active": true,
    "links": [
        {
            "rel": "self",
            "href": "https://api.textking.com/v1/project/bc141454-5949-401b-9c05-7591ee2f5624/job/3bfaa57a-7385-4fec-ae1a-ba2c6bea5679"
        },
        {
            "rel": "urn:textking:project",
            "href": "https://api.textking.com/v1/project/bc141454-5949-401b-9c05-7591ee2f5624"
        },
        {
            "rel": "urn:textking:topic",
            "href": "https://api.textking.com/v1/topic/49353ab0-fdbf-4e1c-a063-cdf4aad98782"
        }
    ]
}