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

POST /projects

Request: POST /projects

Creates a new project with the state prepared and returns the result in the response body. When creating a new project you can set the following attributes:

  • name: The project name (required, 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.

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 project was successfully created, the Content-Location header contains the URI of the created project.
400 Bad Request The input data was incomplete or contained errors.

Example

Create a new project with the name “My Translation Project” and the due date November 16th 2012:

POST /v1/projects HTTP/1.1
Host: api.textking.com
Accept: application/json
Content-Type: application/json
Authorization: Bearer youraccesstoken

{
    "name": "My Translation Project",
    "due_date": "2012-11-16"
}

Response:

HTTP/1.1 201 Created
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": null,
    "name": "My Translation Project",
    "due_date": "2012-11-16T00:00:00",
    "state": "prepared",
    "currency": "EUR",
    "net_price": null,
    "vat": null,
    "coupon_name": null,
    "coupon_value": null,
    "discount_customer": null,
    "discount_project": null,
    "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"
        }
    ]
}