PUT Project - TextKing/textking-api GitHub Wiki

PUT /project/{projectId}

Request: PUT /project/{projectId}

Updates an existing project with the given ID or changes its state. Only projects in the state prepared can be modified. When updating a project you can set the following attributes:

  • name: The project name (can be any non-empty string).
  • due_date: The due date of your project.
  • billing_address: ID of the billing address, see GET /account/addresses
  • coupon_name: Redeem a TEXTKING coupon.
  • affiliate_id: Set your TEXTKING Affiliate ID, if you have one.
  • state: You can change the state of a prepared project either to running (to start the project) or canceled (to cancel the project).

When you set the project state to running, TEXTKING will assign suitable translators to the project and begin translating all of the project’s jobs. The project state will change to finished once all jobs have been translated.

Be careful, setting the project state to running will actually inform our project management to accept and carry out your translation order. To avoid being billed while testing the service please contact us beforehand.

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
200 Ok The project was successfully updated, the Content-Location header contains the URI of the updated project.
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

Change the due date of the project with the ID 29163f4f-7c8f-4baf-adf3-753c1df429c2 and start the project by setting its state to running:

PUT /v1/project/29163f4f-7c8f-4baf-adf3-753c1df429c2 HTTP/1.1
Host: api.textking.com
Accept: application/json
Content-Type: application/json
Authorization: Bearer youraccesstoken

{
    "due_date": "2012-11-17",
    "state": "running"
}

Response:

HTTP/1.1 200 Ok
Content-Type: application/json; charset=utf-8
Location: https://api.textking.com/v1/project/29163f4f-7c8f-4baf-adf3-753c1df429c2
Content-Location: https://api.textking.com/v1/project/29163f4f-7c8f-4baf-adf3-753c1df429c2

{
    "id": "29163f4f-7c8f-4baf-adf3-753c1df429c2",
    "number": "DE1216956",
    "name": "My translation project",
    "due_date": "2012-11-17T00:00:00",
    "state": "running",
    "currency": "EUR",
    "net_price": 282.1,
    "vat": 8,
    "coupon_name": null,
    "coupon_value": null,
    "discount_customer": 0,
    "discount_project": 0,
    "affiliate_id": null,
    "billing_address": "9c6f23b6-167d-4b01-977f-4de799e3abf3",
    "links": [
        {
            "rel": "self",
            "href": "https://api.textking.com/v1/project/29163f4f-7c8f-4baf-adf3-753c1df429c2"
        },
        {
            "rel": "urn:textking:jobs",
            "href": "https://api.textking.com/v1/project/29163f4f-7c8f-4baf-adf3-753c1df429c2/jobs"
        },
        {
            "rel": "urn:textking:line_items",
            "href": "https://api.textking.com/v1/project/29163f4f-7c8f-4baf-adf3-753c1df429c2/line-items"
        },
        {
            "rel": "urn:textking:billing_address",
            "href": "https://api.textking.com/v1/account/address/9c6f23b6-167d-4b01-977f-4de799e3abf3"
        }
    ]
}
⚠️ **GitHub.com Fallback** ⚠️