Skip to content

Repository files navigation

phraseJava

Phrase API Reference

  • API version: 2.0.0
    • Build date: 2021-01-22T08:09:17.702Z[Etc/UTC]

Phrase is a translation management platform for software projects. You can collaborate on language file translation with your team or order translations through our platform. The API allows you to import locale files, download locale files, tag keys or interact in other ways with the localization data stored in Phrase for your account.

API Endpoint

https://api.phrase.com/v2/

The API is only accessible via HTTPS, the base URL is https://api.phrase.com/, and the current version is v2 which results in the base URL for all requests: https://api.phrase.com/v2/.

Usage

curl is used primarily to send requests to Phrase in the examples. On most you'll find a second variant using the Phrase API v2 client that might be more convenient to handle. For further information check its documentation.

Use of HTTP Verbs

Phrase API v2 tries to use the appropriate HTTP verb for accessing each endpoint according to REST specification where possible:

VerbDescription
GETRetrieve one or multiple resources
POSTCreate a resource
PUTUpdate a resource
PATCHUpdate a resource (partially)
DELETEDelete a resource

Identification via User-Agent

You must include the User-Agent header with the name of your application or project. It might be a good idea to include some sort of contact information as well, so that we can get in touch if necessary (e.g. to warn you about Rate-Limiting or badly formed requests). Examples of excellent User-Agent headers:

User-Agent: Example Mobile App (example@phrase.com)
User-Agent: ACME Inc Python Client (http://example.com/contact)

If you don't send this header, you will receive a response with 400 Bad Request.

Lists

When you request a list of resources, the API will typically only return an array of resources including their most important attributes. For a detailed representation of the resource you should request its detailed representation.

Lists are usually paginated.

Parameters

Many endpoints support additional parameters, e.g. for pagination. When passing them in a GET request you can send them as HTTP query string parameters:

$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2\"

When performing a POST, PUT, PATCH or DELETE request, we recommend sending parameters that are not already included in the URL, as JSON body:

$ curl -H 'Content-Type: application/json' -d '{\"name\":\"My new project\"}' -u EMAIL_OR_ACCESS_TOKEN https://api.phrase.com/v2/projects

Encoding parameters as JSON means better support for types (boolean, integer) and usually better readability. Don't forget to set the correct Content-Type for your request.

The Content-Type header is omitted in some of the following examples for better readbility.

Errors

Request Errors

If a request contains invalid JSON or is missing a required parameter (besides resource attributes), the status 400 Bad Request is returned:

{
\"message\": \"JSON could not be parsed\"
}

Validation Errors

When the validation for a resource fails, the status 422 Unprocessable Entity is returned, along with information on the affected fields:

{
\"message\": \"Validation Failed\",
\"errors\": [
{
\"resource\": \"Project\",
\"field\": \"name\",
\"message\": \"can't be blank\"
}
]
}

Date Format

Times and dates are returned and expected in ISO 8601 date format:

YYYY-MM-DDTHH:MM:SSZ

Instead of 'Z' for UTC time zone you can specify your time zone's locale offset using the following notation:

YYYY-MM-DDTHH:MM:SS±hh:mm

Example for CET (1 hour behind UTC):

2015-03-31T13:00+01:00

Please note that in HTTP headers, we will use the appropriate recommended date formats instead of ISO 8601.

Authentication

For more detailed information on authentication, check out the API v2 Authentication Guide.

There are two different ways to authenticate when performing API requests:

  • E-Mail and password
  • Oauth Access Token

E-Mail and password

To get started easily, you can use HTTP Basic authentication with your email and password:

$ curl -u username:password \"https://api.phrase.com/v2/projects\"

OAuth via Access Tokens

You can create and manage access tokens in your profile settings in Translation Center or via the Authorizations API.

Simply pass the access token as the username of your request:

$ curl -u ACCESS_TOKEN: \"https://api.phrase.com/v2/projects\"

or send the access token via the Authorization header field:

$ curl -H \"Authorization: token ACCESS_TOKEN\" https://api.phrase.com/v2/projects

For more detailed information on authentication, check out the <a href="#authentication">API v2 Authentication Guide.

Send via parameter

As JSONP (and other) requests cannot send HTTP Basic Auth credentials, a special query parameter access_token can be used:

curl \"https://api.phrase.com/v2/projects?access_token=ACCESS_TOKEN\"

You should only use this transport method if sending the authentication via header or Basic authentication is not possible.

Two-Factor-Authentication

Users with Two-Factor-Authentication enabled have to send a valid token along their request with certain authentication methods (such as Basic authentication). The necessity of a Two-Factor-Authentication token is indicated by the X-PhraseApp-OTP: required; :MFA-type header in the response. The :MFA-typefield indicates the source of the token, e.g. app (refers to your Authenticator application):

X-PhraseApp-OTP: required; app

To provide a Two-Factor-Authentication token you can simply send it in the header of the request:

curl -H \"X-PhraseApp-OTP: MFA-TOKEN\" -u EMAIL https://api.phrase.com/v2/projects

Since Two-Factor-Authentication tokens usually expire quickly, we recommend using an alternative authentication method such as OAuth access tokens.

Multiple Accounts

Some endpoints require the account ID to be specified if the authenticated user is a member of multiple accounts. You can find the eight-digit account ID inside <a href="https://app.phrase.com/\" target="_blank">Translation Center by switching to the desired account and then visiting the account details page. If required, you can specify the account just like a normal parameter within the request.

Pagination

Endpoints that return a list or resources will usually return paginated results and include 25 items by default. To access further pages, use the page parameter:

$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2\"

Some endpoints also allow a custom page size by using the per_page parameter:

$ curl -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects?page=2&per_page=50\"

Unless specified otherwise in the description of the respective endpoint, per_page allows you to specify a page size up to 100 items.

Link-Headers

We provide you with pagination URLs in the Link Header field. Make use of this information to avoid building pagination URLs yourself.

Link: <https://api.phrase.com/v2/projects?page=1>; rel=\"first\", <https://api.phrase.com/v2/projects?page=3>; rel=\"prev\", <https://api.phrase.com/v2/projects?page=5>; rel=\"next\", <https://api.phrase.com/v2/projects?page=9>; rel=\"last\"

Possible rel values are:

ValueDescription
nextURL of the next page of results
lastURL of the last page of results
firstURL of the first page of results
prevURL of the previous page of results

Rate Limiting

All API endpoints are subject to rate limiting to ensure good performance for all customers. The rate limit is calculated per user:

  • 1000 requests per 5 minutes
  • 4 concurrent (parallel) requests

For your convenience we send information on the current rate limit within the response headers:

HeaderDescription
X-Rate-Limit-LimitNumber of max requests allowed in the current time period
X-Rate-Limit-RemainingNumber of remaining requests in the current time period
X-Rate-Limit-ResetTimestamp of end of current time period as UNIX timestamp

If you should run into the rate limit, you will receive the HTTP status code 429: Too many requests.

If you should need higher rate limits, contact us.

Conditional GET requests / HTTP Caching

Note: Conditional GET requests are currently only supported for locales#download and translations#index

We will return an ETag or Last-Modified header with most GET requests. When you request a resource we recommend to store this value and submit them on subsequent requests as If-Modified-Since and If-None-Match headers. If the resource has not changed in the meantime, we will return the status 304 Not Modified instead of rendering and returning the resource again. In most cases this is less time-consuming and makes your application/integration faster.

Please note that all conditional requests that return a response with status 304 don't count against your rate limits.

$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\"
HTTP/1.1 200 OK
ETag: \"abcd1234abcdefefabcd1234efab1234\"
Last-Modified: Wed, 28 Jan 2015 15:31:30 UTC
Status: 200 OK
$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\" -H 'If-None-Match: \"abcd1234abcdefefabcd1234efab1234\"'
HTTP/1.1 304 Not Modified
ETag: \"abcd1234abcdefefabcd1234efab1234\"
Last-Modified: Wed, 28 Jan 2015 15:31:30 UTC
Status: 304 Not Modified
$ curl -i -u EMAIL_OR_ACCESS_TOKEN \"https://api.phrase.com/v2/projects/1234abcd1234abcdefefabcd1234efab/locales/en/download\" -H \"If-Modified-Since: Wed, 28 Jan 2015 15:31:30 UTC\"
HTTP/1.1 304 Not Modified
Last-Modified: Wed, 28 Jan 2015 15:31:30 UTC
Status: 304 Not Modified

JSONP

The Phrase API supports JSONP for all GET requests in order to deal with cross-domain request issues. Just send a ?callback parameter along with the request to specify the Javascript function name to be called with the response content:

$ curl \"https://api.phrase.com/v2/projects?callback=myFunction\"

The response will include the normal output for that endpoint, along with a meta section including header data:

myFunction({
{
\"meta\": {
\"status\": 200,
...
},
\"data\": [
{
\"id\": \"1234abcd1234abc1234abcd1234abc\"
...
}
]
}
});

To authenticate a JSONP request, you can send a valid access token as the ?access_token parameter along the request:

$ curl \"https://api.phrase.com/v2/projects?callback=myFunction&access_token=ACCESS-TOKEN\"

Usage examples

Learn how to work more efficiently with Phrase API v2 with these workflow-oriented examples.

Find excluded translations with a certain content

GET /v2/projects/:project_id/translations

List excluded translations for the given project which start with the term PhraseApp.

Parameters

NameTypeDescription
sort
optional
stringSort criteria. Can be one of: key_name, created_at, updated_at.
Default: key_name
order
optional
stringOrder direction. Can be one of: asc, desc.
Default: asc
q
optional
stringSpecify a query to find translations by content (including wildcards).

The following qualifiers are supported in the query:
  • id:translation_id,... for queries on a comma-separated list of ids
  • tags:XYZ for tags on the translation
  • unverified:{true|false} for verification status
  • reviewed:{true|false} for reviewed status
  • excluded:{true|false} for exclusion status
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
Find more examples here.

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/translations?sort=updated_at&order=desc&q=PhraseApp*%20excluded:true\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase translations list \\
--project_id <project_id> \\
--sort updated_at \\
--order desc \\
--query 'PhraseApp* excluded:true' \\
--access_token <token>
phraseapp translations list <project_id> \\
--sort updated_at \\
--order desc \\
--query 'PhraseApp* excluded:true'

Find unverified translations with a certain content

GET /v2/projects/:project_id/translations

List unverified translations for the given project which start with the term PhraseApp and are not verified.

Parameters

NameTypeDescription
sort
optional
stringSort criteria. Can be one of: key_name, created_at, updated_at.
Default: key_name
order
optional
stringOrder direction. Can be one of: asc, desc.
Default: asc
q
optional
stringSpecify a query to find translations by content (including wildcards).

The following qualifiers are supported in the query:
  • id:translation_id,... for queries on a comma-separated list of ids
  • tags:XYZ for tags on the translation
  • unverified:{true|false} for verification status
  • reviewed:{true|false} for reviewed status
  • excluded:{true|false} for exclusion status
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
Find more examples here.

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/translations?sort=updated_at&order=desc&q=PhraseApp*%20unverified:true\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase translations list \\
--project_id <project_id> \\
--sort updated_at \\
--order desc \\
--query 'PhraseApp* unverified:true' \\
--access_token <token>
phraseapp translations list <project_id> \\
--sort updated_at \\
--order desc \\
--query 'PhraseApp* unverified:true'

Verify translations selected by query

PATCH /v2/projects/:project_id/translations/verify

Verify all translations that are matching the query my dog.

Parameters

NameTypeDescription
q
optional
stringSpecify a query to find translations by content (including wildcards).

The following qualifiers are supported in the query:
  • id:translation_id,... for queries on a comma-separated list of ids
  • tags:XYZ for tags on the translation
  • unverified:{true|false} for verification status
  • reviewed:{true|false} for reviewed status
  • excluded:{true|false} for exclusion status
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
Find more examples here.
sort
optional
stringSort criteria. Can be one of: key_name, created_at, updated_at.
Default: key_name
order
optional
stringOrder direction. Can be one of: asc, desc.
Default: asc

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/translations/verify\" \\
-u USERNAME_OR_ACCESS_TOKEN \\
-X PATCH \\
-d '{\"q\":\"my dog unverified:true\",\"sort\":\"updated_at\",\"order\":\"desc\"}' \\
-H 'Content-Type: application/json'
phrase translations verify \\
--project_id <project_id> \\
--data '{\"query\":\"\"my dog unverified:true\"\", \"sort\":\"updated_at\", \"order\":\"desc\"}' \\
--access_token <token>
phraseapp translations verify <project_id> \\
--query \"my dog unverified:true\" \\
--sort updated_at \\
--order desc

Find recently updated keys

GET /v2/projects/:project_id/keys

Find updated keys with with the updated_at qualifier like updated_at:>=2013-02-21T00:00:00Z. This example returns keys that have been updated on or after 2013-02-21.

Parameters

NameTypeDescription
sort
optional
stringSort by field. Can be one of: name, created_at, updated_at.
Default: name
order
optional
stringOrder direction. Can be one of: asc, desc.
Default: asc
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.
locale_id

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys?sort=updated_at&order=desc&q=updated_at:%3E=2013-02-21T00:00:00Z&locale_id=abcd1234abcd1234abcd1234abcd1234\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase keys list \\
--project_id <project_id> \\
--sort updated_at \\
--order desc \\
--query \"updated_at:>=2013-02-21T00:00:00Z\" \\
--locale_id abcd1234abcd1234abcd1234abcd1234 \\
--access_token <token>
phraseapp keys list <project_id> \\
--sort updated_at \\
--order desc \\
--query \"updated_at:>=2013-02-21T00:00:00Z\" \\
--locale-id abcd1234abcd1234abcd1234abcd1234

Find keys with a certain tag

GET /v2/projects/:project_id/keys

Keys with certain tags can be filtered with the qualifier tags:.

Parameters

NameTypeDescription
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys?q=tags:admin\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase keys list \\
--project_id <project_id> \\
--query \"tags:admin\" \\
--access_token <token>
phraseapp keys list <project_id> \\
--query \"tags:admin\"

Add tags to collection of keys

PATCH /v2/projects/:project_id/keys/tag

Add the tags landing-page and release-1.2 to all keys that start with dog and are translated in the locale abcd1234abcd1234abcd1234abcd1234.

Parameters

NameTypeDescription
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.
tagsstringTag or comma-separated list of tags to add to the matching collection of keys
locale_id
optional
idLocale used to determine the translation state of a key when filtering for untranslated or translated keys.

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys/tag\" \\
-u USERNAME_OR_ACCESS_TOKEN \\
-X PATCH \\
-d '{\"q\":\"dog* translated:true\",\"tags\":\"landing-page,release-1.2\",\"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\
-H 'Content-Type: application/json'
phrase keys tag \\
--project_id <project_id> \\
--data '{\"query\":\"'dog* translated:true'\", \"tags\":\"landing-page,release-1.2\", \"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\
--access_token <token>
phraseapp keys tag <project_id> \\
--query 'dog* translated:true' \\
--tags landing-page,release-1.2 \\
--locale-id abcd1234abcd1234abcd1234abcd1234

Remove tags from collection of keys

PATCH /v2/projects/:project_id/keys/untag

Remove the tags landing-page and release-1.2 from all keys that start with dog and are translated in the locale abcd1234abcd1234abcd1234abcd1234.

Parameters

NameTypeDescription
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.
tagsstringTag or comma-separated list of tags to remove from the matching collection of keys
locale_id
optional
idLocale used to determine the translation state of a key when filtering for untranslated or translated keys.

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys/untag\" \\
-u USERNAME_OR_ACCESS_TOKEN \\
-X PATCH \\
-d '{\"q\":\"dog* translated:true\",\"tags\":\"landing-page,release-1.2\",\"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\
-H 'Content-Type: application/json'
phrase keys untag \\
--project_id <project_id> \\
--data '{\"query\":\"'dog* translated:true'\", \"tags\":\"landing-page,release-1.2\", \"locale_id\":\"abcd1234abcd1234abcd1234abcd1234\"}' \\
--access_token <token>
phraseapp keys untag <project_id> \\
--query 'dog* translated:true' \\
--tags landing-page,release-1.2 \\
--locale-id abcd1234abcd1234abcd1234abcd1234

Find keys with broad text match

GET /v2/projects/:project_id/keys

Example query my dog

Parameters

NameTypeDescription
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.

Matches

<span class="result-match">My dog is lazy
<span class="result-match">my dog is lazy
<span class="result-match">angry dog in my house

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys?q=my%20dog\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase keys list \\
--project_id <project_id> \\
--query \"my dog\" \\
--access_token <token>
phraseapp keys list <project_id> \\
--query \"my dog\"

Find keys with exact text match

GET /v2/projects/:project_id/keys

Example query \"my dog is lazy\" (note backslashes before any whitespace character in the example query)

Parameters

NameTypeDescription
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.

Matches

My dog is lazy
<span class="result-match">my dog is lazy
angry dog in my house

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys?q=name:my%5C%20dog%5C%20is%5C%20lazy\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase keys list \\
--project_id <project_id> \\
--query \"name:my\\ dog\\ is\\ lazy\" \\
--access_token <token>
phraseapp keys list <project_id> \\
--query \"name:my\\ dog\\ is\\ lazy\"

Find keys with wildcard character matching

GET /v2/projects/:project_id/keys

Example query *dog is*

Parameters

NameTypeDescription
q
optional
stringSpecify a query to do broad search for keys by name (including wildcards).

The following qualifiers are also supported in the search term:
  • ids:key_id,... for queries on a comma-separated list of ids
  • name:key_name for text queries on exact key names - whitespaces need to be prefixed with a backspace (\"\\\")
  • tags:tag_name to filter for keys with certain tags
  • translated:{true|false} for translation status (also requires locale_id to be specified)
  • updated_at:{>=|<=}2013-02-21T00:00:00Z for date range queries
  • unmentioned_in_upload:upload_id to filter keys unmentioned within upload
Find more examples here.

Matches

<span class="result-match">My dog is lazy
<span class="result-match">my dog is lazy
angry dog in my house

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/keys?q=*dog%20is*\" \\
-u USERNAME_OR_ACCESS_TOKEN
phrase keys list \\
--project_id <project_id> \\
--query '*dog is*' \\
--access_token <token>
phraseapp keys list <project_id> \\
--query '*dog is*'

Upload an Excel file with several translations

POST /v2/projects/:project_id/uploads

Suppose you have an excel file where the 'A' column contains the key names, the 'B' column contains English translations, the 'C' column contains German translations and the 'D' column contains comments. Furthermore, the actual content starts in the second row, since the first row is reserved for a header. You can upload this file and import all translations at once\!

Parameters

NameTypeDescription
filefileFile to be imported
file_formatstringFile format. Auto-detected when possible and not specified.
locale_mapping[en]stringName of the column containing translations for locale en.
locale_mapping[de]stringName of the column containing translations for locale de.
format_options[comment_column]stringName of the column containing descriptions for keys.
format_options[tag_column]stringName of the column containing tags for keys.
format_options[key_name_column]stringName of the column containing the names of the keys.
format_options[first_content_row]stringName of the first row containing actual translations.

Example Request

curl \"https://api.phrase.com/v2/projects/:project_id/uploads\" \\
-u USERNAME_OR_ACCESS_TOKEN \\
-X POST \\
-F file=@/path/to/my/file.xlsx \\
-F file_format=xlsx \\
-F locale_mapping[en]=B \\
-F locale_mapping[de]=C \\
-F format_options[comment_column]=D \\
-F format_options[tag_column]=E \\
-F format_options[key_name_column]=A \\
-F format_options[first_content_row]=2
phrase uploads create \\
--project_id <project_id> \\
--file /path/to/my/file.xlsx \\
--file_format xlsx \\
--locale_id abcd1234cdef1234abcd1234cdef1234 \\
--tags awesome-feature,needs-proofreading \\
--locale_mapping '{\"en\": \"B\", \"de\": \"C\"}' \\
--format_options '{\"comment_column\": \"D\", \"tag_column\": \"E\", \"key_name_column\": \"A\", \"first_content_row\": \"2\"}' \\
--access_token <token>
phraseapp upload create <project_id> \\
--file /path/to/my/file.xlsx \\
--file-format xlsx \\
--locale-mapping[en] B \\
--locale-mapping[de] C \\
--format-options[comment-column] D \\
--format-options[tag-column] E \\
--format-options[key-name-column] A \\
--format-options[first-content-row] 2

For more information, please visit https://developers.phrase.com/api/

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
<groupId>com.phrase</groupId>
<artifactId>phraseJava</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.phrase:phraseJava:1.0.2"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/phraseJava-1.0.2.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

// Import classes:importcom.phrase.client.ApiClient;
importcom.phrase.client.ApiException;
importcom.phrase.client.Configuration;
importcom.phrase.client.auth.*;
importcom.phrase.client.models.*;
importcom.phrase.client.api.AccountsApi;
publicclassExample {
publicstaticvoidmain(String[] args) {
ApiClientdefaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://api.phrase.com/v2");
// Configure HTTP basic authorization: BasicHttpBasicAuthBasic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");
// Configure API key authorization: TokenApiKeyAuthToken = (ApiKeyAuth) defaultClient.getAuthentication("Token");
Token.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Token.setApiKeyPrefix("Token");AccountsApiapiInstance = newAccountsApi(defaultClient);
Stringid = "id_example"; // String | IDStringxPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)try {
AccountDetailsresult = apiInstance.accountShow(id, xPhraseAppOTP);
System.out.println(result);
} catch (ApiExceptione) {
System.err.println("Exception when calling AccountsApi#accountShow");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}

Documentation for API Endpoints

All URIs are relative to https://api.phrase.com/v2

ClassMethodHTTP requestDescription
AccountsApiaccountShowGET /accounts/{id}Get a single account
AccountsApiaccountsListGET /accountsList accounts
AuthorizationsApiauthorizationCreatePOST /authorizationsCreate an authorization
AuthorizationsApiauthorizationDeleteDELETE /authorizations/{id}Delete an authorization
AuthorizationsApiauthorizationShowGET /authorizations/{id}Get a single authorization
AuthorizationsApiauthorizationUpdatePATCH /authorizations/{id}Update an authorization
AuthorizationsApiauthorizationsListGET /authorizationsList authorizations
BitbucketSyncApibitbucketSyncExportPOST /bitbucket_syncs/{id}/exportExport from Phrase to Bitbucket
BitbucketSyncApibitbucketSyncImportPOST /bitbucket_syncs/{id}/importImport to Phrase from Bitbucket
BitbucketSyncApibitbucketSyncsListGET /bitbucket_syncsList Bitbucket syncs
BlacklistedKeysApiblacklistedKeyCreatePOST /projects/{project_id}/blacklisted_keysCreate a blacklisted key
BlacklistedKeysApiblacklistedKeyDeleteDELETE /projects/{project_id}/blacklisted_keys/{id}Delete a blacklisted key
BlacklistedKeysApiblacklistedKeyShowGET /projects/{project_id}/blacklisted_keys/{id}Get a single blacklisted key
BlacklistedKeysApiblacklistedKeyUpdatePATCH /projects/{project_id}/blacklisted_keys/{id}Update a blacklisted key
BlacklistedKeysApiblacklistedKeysListGET /projects/{project_id}/blacklisted_keysList blacklisted keys
BranchesApibranchCompareGET /projects/{project_id}/branches/{name}/compareCompare branches
BranchesApibranchCreatePOST /projects/{project_id}/branchesCreate a branch
BranchesApibranchDeleteDELETE /projects/{project_id}/branches/{name}Delete a branch
BranchesApibranchMergePATCH /projects/{project_id}/branches/{name}/mergeMerge a branch
BranchesApibranchShowGET /projects/{project_id}/branches/{name}Get a single branch
BranchesApibranchUpdatePATCH /projects/{project_id}/branches/{name}Update a branch
BranchesApibranchesListGET /projects/{project_id}/branchesList branches
CommentsApicommentCreatePOST /projects/{project_id}/keys/{key_id}/commentsCreate a comment
CommentsApicommentDeleteDELETE /projects/{project_id}/keys/{key_id}/comments/{id}Delete a comment
CommentsApicommentMarkCheckGET /projects/{project_id}/keys/{key_id}/comments/{id}/readCheck if comment is read
CommentsApicommentMarkReadPATCH /projects/{project_id}/keys/{key_id}/comments/{id}/readMark a comment as read
CommentsApicommentMarkUnreadDELETE /projects/{project_id}/keys/{key_id}/comments/{id}/readMark a comment as unread
CommentsApicommentShowGET /projects/{project_id}/keys/{key_id}/comments/{id}Get a single comment
CommentsApicommentUpdatePATCH /projects/{project_id}/keys/{key_id}/comments/{id}Update a comment
CommentsApicommentsListGET /projects/{project_id}/keys/{key_id}/commentsList comments
DistributionsApidistributionCreatePOST /accounts/{account_id}/distributionsCreate a distribution
DistributionsApidistributionDeleteDELETE /accounts/{account_id}/distributions/{id}Delete a distribution
DistributionsApidistributionShowGET /accounts/{account_id}/distributions/{id}Get a single distribution
DistributionsApidistributionUpdatePATCH /accounts/{account_id}/distributions/{id}Update a distribution
DistributionsApidistributionsListGET /accounts/{account_id}/distributionsList distributions
DocumentsApidocumentDeleteDELETE /projects/{project_id}/documents/{id}Delete document
DocumentsApidocumentsListGET /projects/{project_id}/documentsList documents
FormatsApiformatsListGET /formatsList formats
GitHubSyncApigithubSyncExportPOST /github_syncs/exportExport from Phrase to GitHub
GitHubSyncApigithubSyncImportPOST /github_syncs/importImport to Phrase from GitHub
GitLabSyncApigitlabSyncDeleteDELETE /gitlab_syncs/{id}Delete single Sync Setting
GitLabSyncApigitlabSyncExportPOST /gitlab_syncs/{gitlab_sync_id}/exportExport from Phrase to GitLab
GitLabSyncApigitlabSyncHistoryGET /gitlab_syncs/{gitlab_sync_id}/historyHistory of single Sync Setting
GitLabSyncApigitlabSyncImportPOST /gitlab_syncs/{gitlab_sync_id}/importImport from GitLab to Phrase
GitLabSyncApigitlabSyncListGET /gitlab_syncsList GitLab syncs
GitLabSyncApigitlabSyncShowGET /gitlab_syncs/{id}Get single Sync Setting
GitLabSyncApigitlabSyncUpdatePUT /gitlab_syncs/{id}Update single Sync Setting
GlossariesApiglossariesListGET /accounts/{account_id}/glossariesList glossaries
GlossariesApiglossaryCreatePOST /accounts/{account_id}/glossariesCreate a glossary
GlossariesApiglossaryDeleteDELETE /accounts/{account_id}/glossaries/{id}Delete a glossary
GlossariesApiglossaryShowGET /accounts/{account_id}/glossaries/{id}Get a single glossary
GlossariesApiglossaryUpdatePATCH /accounts/{account_id}/glossaries/{id}Update a glossary
GlossaryTermTranslationsApiglossaryTermTranslationCreatePOST /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translationsCreate a glossary term translation
GlossaryTermTranslationsApiglossaryTermTranslationDeleteDELETE /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id}Delete a glossary term translation
GlossaryTermTranslationsApiglossaryTermTranslationUpdatePATCH /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id}Update a glossary term translation
GlossaryTermsApiglossaryTermCreatePOST /accounts/{account_id}/glossaries/{glossary_id}/termsCreate a glossary term
GlossaryTermsApiglossaryTermDeleteDELETE /accounts/{account_id}/glossaries/{glossary_id}/terms/{id}Delete a glossary term
GlossaryTermsApiglossaryTermShowGET /accounts/{account_id}/glossaries/{glossary_id}/terms/{id}Get a single glossary term
GlossaryTermsApiglossaryTermUpdatePATCH /accounts/{account_id}/glossaries/{glossary_id}/terms/{id}Update a glossary term
GlossaryTermsApiglossaryTermsListGET /accounts/{account_id}/glossaries/{glossary_id}/termsList glossary terms
InvitationsApiinvitationCreatePOST /accounts/{account_id}/invitationsCreate a new invitation
InvitationsApiinvitationDeleteDELETE /accounts/{account_id}/invitations/{id}Delete an invitation
InvitationsApiinvitationResendPOST /accounts/{account_id}/invitations/{id}/resendResend an invitation
InvitationsApiinvitationShowGET /accounts/{account_id}/invitations/{id}Get a single invitation
InvitationsApiinvitationUpdatePATCH /accounts/{account_id}/invitations/{id}Update an invitation
InvitationsApiinvitationUpdateSettingsPATCH /projects/{project_id}/invitations/{id}Update a member's invitation access
InvitationsApiinvitationsListGET /accounts/{account_id}/invitationsList invitations
JobLocalesApijobLocaleCompletePOST /projects/{project_id}/jobs/{job_id}/locales/{id}/completeComplete a job locale
JobLocalesApijobLocaleDeleteDELETE /projects/{project_id}/jobs/{job_id}/locales/{id}Delete a job locale
JobLocalesApijobLocaleReopenPOST /projects/{project_id}/jobs/{job_id}/locales/{id}/reopenReopen a job locale
JobLocalesApijobLocaleShowGET /projects/{project_id}/jobs/{job_id}/locale/{id}Get a single job locale
JobLocalesApijobLocaleUpdatePATCH /projects/{project_id}/jobs/{job_id}/locales/{id}Update a job locale
JobLocalesApijobLocalesCreatePOST /projects/{project_id}/jobs/{job_id}/localesCreate a job locale
JobLocalesApijobLocalesListGET /projects/{project_id}/jobs/{job_id}/localesList job locales
JobsApijobCompletePOST /projects/{project_id}/jobs/{id}/completeComplete a job
JobsApijobCreatePOST /projects/{project_id}/jobsCreate a job
JobsApijobDeleteDELETE /projects/{project_id}/jobs/{id}Delete a job
JobsApijobKeysCreatePOST /projects/{project_id}/jobs/{id}/keysAdd keys to job
JobsApijobKeysDeleteDELETE /projects/{project_id}/jobs/{id}/keysRemove keys from job
JobsApijobReopenPOST /projects/{project_id}/jobs/{id}/reopenReopen a job
JobsApijobShowGET /projects/{project_id}/jobs/{id}Get a single job
JobsApijobStartPOST /projects/{project_id}/jobs/{id}/startStart a job
JobsApijobUpdatePATCH /projects/{project_id}/jobs/{id}Update a job
JobsApijobsByAccountGET /accounts/{account_id}/jobsList account jobs
JobsApijobsListGET /projects/{project_id}/jobsList jobs
KeysApikeyCreatePOST /projects/{project_id}/keysCreate a key
KeysApikeyDeleteDELETE /projects/{project_id}/keys/{id}Delete a key
KeysApikeyShowGET /projects/{project_id}/keys/{id}Get a single key
KeysApikeyUpdatePATCH /projects/{project_id}/keys/{id}Update a key
KeysApikeysDeleteDELETE /projects/{project_id}/keysDelete collection of keys
KeysApikeysListGET /projects/{project_id}/keysList keys
KeysApikeysSearchPOST /projects/{project_id}/keys/searchSearch keys
KeysApikeysTagPATCH /projects/{project_id}/keys/tagAdd tags to collection of keys
KeysApikeysUntagPATCH /projects/{project_id}/keys/untagRemove tags from collection of keys
LocalesApilocaleCreatePOST /projects/{project_id}/localesCreate a locale
LocalesApilocaleDeleteDELETE /projects/{project_id}/locales/{id}Delete a locale
LocalesApilocaleDownloadGET /projects/{project_id}/locales/{id}/downloadDownload a locale
LocalesApilocaleShowGET /projects/{project_id}/locales/{id}Get a single locale
LocalesApilocaleUpdatePATCH /projects/{project_id}/locales/{id}Update a locale
LocalesApilocalesListGET /projects/{project_id}/localesList locales
MembersApimemberDeleteDELETE /accounts/{account_id}/members/{id}Remove a user from the account
MembersApimemberShowGET /accounts/{account_id}/members/{id}Get single member
MembersApimemberUpdatePATCH /accounts/{account_id}/members/{id}Update a member
MembersApimemberUpdateSettingsPATCH /projects/{project_id}/members/{id}Update a member's project settings
MembersApimembersListGET /accounts/{account_id}/membersList members
OrdersApiorderConfirmPATCH /projects/{project_id}/orders/{id}/confirmConfirm an order
OrdersApiorderCreatePOST /projects/{project_id}/ordersCreate a new order
OrdersApiorderDeleteDELETE /projects/{project_id}/orders/{id}Cancel an order
OrdersApiorderShowGET /projects/{project_id}/orders/{id}Get a single order
OrdersApiordersListGET /projects/{project_id}/ordersList orders
ProjectsApiprojectCreatePOST /projectsCreate a project
ProjectsApiprojectDeleteDELETE /projects/{id}Delete a project
ProjectsApiprojectShowGET /projects/{id}Get a single project
ProjectsApiprojectUpdatePATCH /projects/{id}Update a project
ProjectsApiprojectsListGET /projectsList projects
ReleasesApireleaseCreatePOST /accounts/{account_id}/distributions/{distribution_id}/releasesCreate a release
ReleasesApireleaseDeleteDELETE /accounts/{account_id}/distributions/{distribution_id}/releases/{id}Delete a release
ReleasesApireleasePublishPOST /accounts/{account_id}/distributions/{distribution_id}/releases/{id}/publishPublish a release
ReleasesApireleaseShowGET /accounts/{account_id}/distributions/{distribution_id}/releases/{id}Get a single release
ReleasesApireleaseUpdatePATCH /accounts/{account_id}/distributions/{distribution_id}/releases/{id}Update a release
ReleasesApireleasesListGET /accounts/{account_id}/distributions/{distribution_id}/releasesList releases
ScreenshotMarkersApiscreenshotMarkerCreatePOST /projects/{project_id}/screenshots/{screenshot_id}/markersCreate a screenshot marker
ScreenshotMarkersApiscreenshotMarkerDeleteDELETE /projects/{project_id}/screenshots/{screenshot_id}/markersDelete a screenshot marker
ScreenshotMarkersApiscreenshotMarkerShowGET /projects/{project_id}/screenshots/{screenshot_id}/markers/{id}Get a single screenshot marker
ScreenshotMarkersApiscreenshotMarkerUpdatePATCH /projects/{project_id}/screenshots/{screenshot_id}/markersUpdate a screenshot marker
ScreenshotMarkersApiscreenshotMarkersListGET /projects/{project_id}/screenshots/{id}/markersList screenshot markers
ScreenshotsApiscreenshotCreatePOST /projects/{project_id}/screenshotsCreate a screenshot
ScreenshotsApiscreenshotDeleteDELETE /projects/{project_id}/screenshots/{id}Delete a screenshot
ScreenshotsApiscreenshotShowGET /projects/{project_id}/screenshots/{id}Get a single screenshot
ScreenshotsApiscreenshotUpdatePATCH /projects/{project_id}/screenshots/{id}Update a screenshot
ScreenshotsApiscreenshotsListGET /projects/{project_id}/screenshotsList screenshots
SpacesApispaceCreatePOST /accounts/{account_id}/spacesCreate a Space
SpacesApispaceDeleteDELETE /accounts/{account_id}/spaces/{id}Delete Space
SpacesApispaceShowGET /accounts/{account_id}/spaces/{id}Get Space
SpacesApispaceUpdatePATCH /accounts/{account_id}/spaces/{id}Update Space
SpacesApispacesListGET /accounts/{account_id}/spacesList Spaces
SpacesApispacesProjectsCreatePOST /accounts/{account_id}/spaces/{space_id}/projectsAdd Project
SpacesApispacesProjectsDeleteDELETE /accounts/{account_id}/spaces/{space_id}/projects/{id}Remove Project
SpacesApispacesProjectsListGET /accounts/{account_id}/spaces/{space_id}/projectsList Projects
StyleGuidesApistyleguideCreatePOST /projects/{project_id}/styleguidesCreate a style guide
StyleGuidesApistyleguideDeleteDELETE /projects/{project_id}/styleguides/{id}Delete a style guide
StyleGuidesApistyleguideShowGET /projects/{project_id}/styleguides/{id}Get a single style guide
StyleGuidesApistyleguideUpdatePATCH /projects/{project_id}/styleguides/{id}Update a style guide
StyleGuidesApistyleguidesListGET /projects/{project_id}/styleguidesList style guides
TagsApitagCreatePOST /projects/{project_id}/tagsCreate a tag
TagsApitagDeleteDELETE /projects/{project_id}/tags/{name}Delete a tag
TagsApitagShowGET /projects/{project_id}/tags/{name}Get a single tag
TagsApitagsListGET /projects/{project_id}/tagsList tags
TeamsApiteamCreatePOST /accounts/{account_id}/teamsCreate a Team
TeamsApiteamDeleteDELETE /accounts/{account_id}/teams/{team_id}Delete Team
TeamsApiteamShowGET /accounts/{account_id}/teams/{team_id}Get Team
TeamsApiteamUpdatePATCH /accounts/{account_id}/teams/{team_id}Update Team
TeamsApiteamsListGET /accounts/{account_id}/teamsList Teams
TeamsApiteamsProjectsCreatePOST /accounts/{account_id}/teams/{team_id}/projectsAdd Project
TeamsApiteamsProjectsDeleteDELETE /accounts/{account_id}/teams/{team_id}/projects/{id}Remove Project
TeamsApiteamsSpacesCreatePOST /accounts/{account_id}/teams/{team_id}/spacesAdd Space
TeamsApiteamsSpacesDeleteDELETE /accounts/{account_id}/teams/{team_id}/spaces/{id}Remove Space
TeamsApiteamsUsersCreatePOST /accounts/{account_id}/teams/{team_id}/usersAdd User
TeamsApiteamsUsersDeleteDELETE /accounts/{account_id}/teams/{team_id}/users/{id}Remove User
TranslationsApitranslationCreatePOST /projects/{project_id}/translationsCreate a translation
TranslationsApitranslationExcludePATCH /projects/{project_id}/translations/{id}/excludeExclude a translation from export
TranslationsApitranslationIncludePATCH /projects/{project_id}/translations/{id}/includeRevoke exclusion of a translation in export
TranslationsApitranslationReviewPATCH /projects/{project_id}/translations/{id}/reviewReview a translation
TranslationsApitranslationShowGET /projects/{project_id}/translations/{id}Get a single translation
TranslationsApitranslationUnverifyPATCH /projects/{project_id}/translations/{id}/unverifyMark a translation as unverified
TranslationsApitranslationUpdatePATCH /projects/{project_id}/translations/{id}Update a translation
TranslationsApitranslationVerifyPATCH /projects/{project_id}/translations/{id}/verifyVerify a translation
TranslationsApitranslationsByKeyGET /projects/{project_id}/keys/{key_id}/translationsList translations by key
TranslationsApitranslationsByLocaleGET /projects/{project_id}/locales/{locale_id}/translationsList translations by locale
TranslationsApitranslationsExcludePATCH /projects/{project_id}/translations/excludeSet exclude from export flag on translations selected by query
TranslationsApitranslationsIncludePATCH /projects/{project_id}/translations/includeRemove exlude from import flag from translations selected by query
TranslationsApitranslationsListGET /projects/{project_id}/translationsList all translations
TranslationsApitranslationsReviewPATCH /projects/{project_id}/translations/reviewReview translations selected by query
TranslationsApitranslationsSearchPOST /projects/{project_id}/translations/searchSearch translations
TranslationsApitranslationsUnverifyPATCH /projects/{project_id}/translations/unverifyMark translations selected by query as unverified
TranslationsApitranslationsVerifyPATCH /projects/{project_id}/translations/verifyVerify translations selected by query
UploadsApiuploadCreatePOST /projects/{project_id}/uploadsUpload a new file
UploadsApiuploadShowGET /projects/{project_id}/uploads/{id}View upload details
UploadsApiuploadsListGET /projects/{project_id}/uploadsList uploads
UsersApishowUserGET /userShow current User
VariablesApivariableCreatePOST /projects/{project_id}/variablesCreate a variable
VariablesApivariableDeleteDELETE /projects/{project_id}/variables/{name}Delete a variable
VariablesApivariableShowGET /projects/{project_id}/variables/{name}Get a single variable
VariablesApivariableUpdatePATCH /projects/{project_id}/variables/{name}Update a variable
VariablesApivariablesListGET /projects/{project_id}/variablesList variables
VersionsHistoryApiversionShowGET /projects/{project_id}/translations/{translation_id}/versions/{id}Get a single version
VersionsHistoryApiversionsListGET /projects/{project_id}/translations/{translation_id}/versionsList all versions
WebhooksApiwebhookCreatePOST /projects/{project_id}/webhooksCreate a webhook
WebhooksApiwebhookDeleteDELETE /projects/{project_id}/webhooks/{id}Delete a webhook
WebhooksApiwebhookShowGET /projects/{project_id}/webhooks/{id}Get a single webhook
WebhooksApiwebhookTestPOST /projects/{project_id}/webhooks/{id}/testTest a webhook
WebhooksApiwebhookUpdatePATCH /projects/{project_id}/webhooks/{id}Update a webhook
WebhooksApiwebhooksListGET /projects/{project_id}/webhooksList webhooks

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

Basic

  • Type: HTTP basic authentication

Token

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

support@phrase.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages