API endpoints

July 14, 2017

100% of the API is implemented as a GraphQL API. But to ensure that integration with common tools such as curl is simple, we also provide a basic HTTP API for the most used operations:

Sync

Endpoint

POST /sync

Required params

  • project_id
  • file
  • language
  • document_format
  • document_path

Response

Success

  • OK 200 – The sync succeeded

Error

  • Not found 404 – Unknown project
  • Unprocessable entity 422 – Missing/invalid params

Add translations

Endpoint

POST /add-translations

Required params

  • project_id
  • file
  • language
  • document_format
  • document_path

Optional params

  • merge_type (smart, passive or force, default to smart)

Response

Success

  • OK 200 – The merge succeeded

Error

  • Not found 404 – Unknown project
  • Unprocessable entity 422 – Missing/invalid params

Peek

The API offers a way to preview operations.

By adding /peek to POST /sync and POST /add-translations, the operation will not "commit" and the response will be a series of activity.

  • POST /sync/peek
  • POST /add-translations/peek

Response

{
  "data": {
    "stats": {
      "e8b4bdf8-dc21-4af9-a017-aae4b4cb04eb": {
        "conflict_on_proposed": 1
      }
    },
    "operations": {
      "e8b4bdf8-dc21-4af9-a017-aae4b4cb04eb": [{
        "text": "Foo",
        "previous-text": "Bar",
        "key": "general.application.name",
        "action": "conflict_on_proposed"
      }]
    }
  }
}

Export

Required params

  • language_id
  • document_format
  • document_path

Optional params

  • order_by (index or key-asc, default to index)

Response

  • OK 200

Error

  • Not found 404 – Unknown project, language, format…

cURL example

$ curl "export/?project_id=project-uuid&language=en&document_format=strings&document_path=Localization.strings"
Ready to get started?

Deploy Accent and start translating your project!