Skip to content

chtpl/phrase-java

 
 

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:

Verb Description
GET Retrieve one or multiple resources
POST Create a resource
PUT Update a resource
PATCH Update a resource (partially)
DELETE Delete 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 ([email protected])
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:

Value Description
next URL of the next page of results
last URL of the last page of results
first URL of the first page of results
prev URL 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:

Header Description
X-Rate-Limit-Limit Number of max requests allowed in the current time period
X-Rate-Limit-Remaining Number of remaining requests in the current time period
X-Rate-Limit-Reset Timestamp 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

Name Type Description
sort
optional
string Sort criteria. Can be one of: key_name, created_at, updated_at.
Default: key_name
order
optional
string Order direction. Can be one of: asc, desc.
Default: asc
q
optional
string Specify 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

Name Type Description
sort
optional
string Sort criteria. Can be one of: key_name, created_at, updated_at.
Default: key_name
order
optional
string Order direction. Can be one of: asc, desc.
Default: asc
q
optional
string Specify 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

Name Type Description
q
optional
string Specify 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
string Sort criteria. Can be one of: key_name, created_at, updated_at.
Default: key_name
order
optional
string Order 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

Name Type Description
sort
optional
string Sort by field. Can be one of: name, created_at, updated_at.
Default: name
order
optional
string Order direction. Can be one of: asc, desc.
Default: asc
q
optional
string Specify 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

Name Type Description
q
optional
string Specify 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

Name Type Description
q
optional
string Specify 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.
tags string Tag or comma-separated list of tags to add to the matching collection of keys
locale_id
optional
id Locale 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

Name Type Description
q
optional
string Specify 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.
tags string Tag or comma-separated list of tags to remove from the matching collection of keys
locale_id
optional
id Locale 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

Name Type Description
q
optional
string Specify 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

Name Type Description
q
optional
string Specify 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

Name Type Description
q
optional
string Specify 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

Name Type Description
file file File to be imported
file_format string File format. Auto-detected when possible and not specified.
locale_mapping[en] string Name of the column containing translations for locale en.
locale_mapping[de] string Name of the column containing translations for locale de.
format_options[comment_column] string Name of the column containing descriptions for keys.
format_options[tag_column] string Name of the column containing tags for keys.
format_options[key_name_column] string Name of the column containing the names of the keys.
format_options[first_content_row] string Name 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:
import com.phrase.client.ApiClient;
import com.phrase.client.ApiException;
import com.phrase.client.Configuration;
import com.phrase.client.auth.*;
import com.phrase.client.models.*;
import com.phrase.client.api.AccountsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://api.phrase.com/v2");
    
    // Configure HTTP basic authorization: Basic
    HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
    Basic.setUsername("YOUR USERNAME");
    Basic.setPassword("YOUR PASSWORD");

    // Configure API key authorization: Token
    ApiKeyAuth Token = (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");

    AccountsApi apiInstance = new AccountsApi(defaultClient);
    String id = "id_example"; // String | ID
    String xPhraseAppOTP = "xPhraseAppOTP_example"; // String | Two-Factor-Authentication token (optional)
    try {
      AccountDetails result = apiInstance.accountShow(id, xPhraseAppOTP);
      System.out.println(result);
    } catch (ApiException e) {
      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

Class Method HTTP request Description
AccountsApi accountShow GET /accounts/{id} Get a single account
AccountsApi accountsList GET /accounts List accounts
AuthorizationsApi authorizationCreate POST /authorizations Create an authorization
AuthorizationsApi authorizationDelete DELETE /authorizations/{id} Delete an authorization
AuthorizationsApi authorizationShow GET /authorizations/{id} Get a single authorization
AuthorizationsApi authorizationUpdate PATCH /authorizations/{id} Update an authorization
AuthorizationsApi authorizationsList GET /authorizations List authorizations
BitbucketSyncApi bitbucketSyncExport POST /bitbucket_syncs/{id}/export Export from Phrase to Bitbucket
BitbucketSyncApi bitbucketSyncImport POST /bitbucket_syncs/{id}/import Import to Phrase from Bitbucket
BitbucketSyncApi bitbucketSyncsList GET /bitbucket_syncs List Bitbucket syncs
BlacklistedKeysApi blacklistedKeyCreate POST /projects/{project_id}/blacklisted_keys Create a blacklisted key
BlacklistedKeysApi blacklistedKeyDelete DELETE /projects/{project_id}/blacklisted_keys/{id} Delete a blacklisted key
BlacklistedKeysApi blacklistedKeyShow GET /projects/{project_id}/blacklisted_keys/{id} Get a single blacklisted key
BlacklistedKeysApi blacklistedKeyUpdate PATCH /projects/{project_id}/blacklisted_keys/{id} Update a blacklisted key
BlacklistedKeysApi blacklistedKeysList GET /projects/{project_id}/blacklisted_keys List blacklisted keys
BranchesApi branchCompare GET /projects/{project_id}/branches/{name}/compare Compare branches
BranchesApi branchCreate POST /projects/{project_id}/branches Create a branch
BranchesApi branchDelete DELETE /projects/{project_id}/branches/{name} Delete a branch
BranchesApi branchMerge PATCH /projects/{project_id}/branches/{name}/merge Merge a branch
BranchesApi branchShow GET /projects/{project_id}/branches/{name} Get a single branch
BranchesApi branchUpdate PATCH /projects/{project_id}/branches/{name} Update a branch
BranchesApi branchesList GET /projects/{project_id}/branches List branches
CommentsApi commentCreate POST /projects/{project_id}/keys/{key_id}/comments Create a comment
CommentsApi commentDelete DELETE /projects/{project_id}/keys/{key_id}/comments/{id} Delete a comment
CommentsApi commentMarkCheck GET /projects/{project_id}/keys/{key_id}/comments/{id}/read Check if comment is read
CommentsApi commentMarkRead PATCH /projects/{project_id}/keys/{key_id}/comments/{id}/read Mark a comment as read
CommentsApi commentMarkUnread DELETE /projects/{project_id}/keys/{key_id}/comments/{id}/read Mark a comment as unread
CommentsApi commentShow GET /projects/{project_id}/keys/{key_id}/comments/{id} Get a single comment
CommentsApi commentUpdate PATCH /projects/{project_id}/keys/{key_id}/comments/{id} Update a comment
CommentsApi commentsList GET /projects/{project_id}/keys/{key_id}/comments List comments
DistributionsApi distributionCreate POST /accounts/{account_id}/distributions Create a distribution
DistributionsApi distributionDelete DELETE /accounts/{account_id}/distributions/{id} Delete a distribution
DistributionsApi distributionShow GET /accounts/{account_id}/distributions/{id} Get a single distribution
DistributionsApi distributionUpdate PATCH /accounts/{account_id}/distributions/{id} Update a distribution
DistributionsApi distributionsList GET /accounts/{account_id}/distributions List distributions
DocumentsApi documentDelete DELETE /projects/{project_id}/documents/{id} Delete document
DocumentsApi documentsList GET /projects/{project_id}/documents List documents
FormatsApi formatsList GET /formats List formats
GitHubSyncApi githubSyncExport POST /github_syncs/export Export from Phrase to GitHub
GitHubSyncApi githubSyncImport POST /github_syncs/import Import to Phrase from GitHub
GitLabSyncApi gitlabSyncDelete DELETE /gitlab_syncs/{id} Delete single Sync Setting
GitLabSyncApi gitlabSyncExport POST /gitlab_syncs/{gitlab_sync_id}/export Export from Phrase to GitLab
GitLabSyncApi gitlabSyncHistory GET /gitlab_syncs/{gitlab_sync_id}/history History of single Sync Setting
GitLabSyncApi gitlabSyncImport POST /gitlab_syncs/{gitlab_sync_id}/import Import from GitLab to Phrase
GitLabSyncApi gitlabSyncList GET /gitlab_syncs List GitLab syncs
GitLabSyncApi gitlabSyncShow GET /gitlab_syncs/{id} Get single Sync Setting
GitLabSyncApi gitlabSyncUpdate PUT /gitlab_syncs/{id} Update single Sync Setting
GlossariesApi glossariesList GET /accounts/{account_id}/glossaries List glossaries
GlossariesApi glossaryCreate POST /accounts/{account_id}/glossaries Create a glossary
GlossariesApi glossaryDelete DELETE /accounts/{account_id}/glossaries/{id} Delete a glossary
GlossariesApi glossaryShow GET /accounts/{account_id}/glossaries/{id} Get a single glossary
GlossariesApi glossaryUpdate PATCH /accounts/{account_id}/glossaries/{id} Update a glossary
GlossaryTermTranslationsApi glossaryTermTranslationCreate POST /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations Create a glossary term translation
GlossaryTermTranslationsApi glossaryTermTranslationDelete DELETE /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id} Delete a glossary term translation
GlossaryTermTranslationsApi glossaryTermTranslationUpdate PATCH /accounts/{account_id}/glossaries/{glossary_id}/terms/{term_id}/translations/{id} Update a glossary term translation
GlossaryTermsApi glossaryTermCreate POST /accounts/{account_id}/glossaries/{glossary_id}/terms Create a glossary term
GlossaryTermsApi glossaryTermDelete DELETE /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} Delete a glossary term
GlossaryTermsApi glossaryTermShow GET /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} Get a single glossary term
GlossaryTermsApi glossaryTermUpdate PATCH /accounts/{account_id}/glossaries/{glossary_id}/terms/{id} Update a glossary term
GlossaryTermsApi glossaryTermsList GET /accounts/{account_id}/glossaries/{glossary_id}/terms List glossary terms
InvitationsApi invitationCreate POST /accounts/{account_id}/invitations Create a new invitation
InvitationsApi invitationDelete DELETE /accounts/{account_id}/invitations/{id} Delete an invitation
InvitationsApi invitationResend POST /accounts/{account_id}/invitations/{id}/resend Resend an invitation
InvitationsApi invitationShow GET /accounts/{account_id}/invitations/{id} Get a single invitation
InvitationsApi invitationUpdate PATCH /accounts/{account_id}/invitations/{id} Update an invitation
InvitationsApi invitationUpdateSettings PATCH /projects/{project_id}/invitations/{id} Update a member's invitation access
InvitationsApi invitationsList GET /accounts/{account_id}/invitations List invitations
JobLocalesApi jobLocaleComplete POST /projects/{project_id}/jobs/{job_id}/locales/{id}/complete Complete a job locale
JobLocalesApi jobLocaleDelete DELETE /projects/{project_id}/jobs/{job_id}/locales/{id} Delete a job locale
JobLocalesApi jobLocaleReopen POST /projects/{project_id}/jobs/{job_id}/locales/{id}/reopen Reopen a job locale
JobLocalesApi jobLocaleShow GET /projects/{project_id}/jobs/{job_id}/locale/{id} Get a single job locale
JobLocalesApi jobLocaleUpdate PATCH /projects/{project_id}/jobs/{job_id}/locales/{id} Update a job locale
JobLocalesApi jobLocalesCreate POST /projects/{project_id}/jobs/{job_id}/locales Create a job locale
JobLocalesApi jobLocalesList GET /projects/{project_id}/jobs/{job_id}/locales List job locales
JobsApi jobComplete POST /projects/{project_id}/jobs/{id}/complete Complete a job
JobsApi jobCreate POST /projects/{project_id}/jobs Create a job
JobsApi jobDelete DELETE /projects/{project_id}/jobs/{id} Delete a job
JobsApi jobKeysCreate POST /projects/{project_id}/jobs/{id}/keys Add keys to job
JobsApi jobKeysDelete DELETE /projects/{project_id}/jobs/{id}/keys Remove keys from job
JobsApi jobReopen POST /projects/{project_id}/jobs/{id}/reopen Reopen a job
JobsApi jobShow GET /projects/{project_id}/jobs/{id} Get a single job
JobsApi jobStart POST /projects/{project_id}/jobs/{id}/start Start a job
JobsApi jobUpdate PATCH /projects/{project_id}/jobs/{id} Update a job
JobsApi jobsByAccount GET /accounts/{account_id}/jobs List account jobs
JobsApi jobsList GET /projects/{project_id}/jobs List jobs
KeysApi keyCreate POST /projects/{project_id}/keys Create a key
KeysApi keyDelete DELETE /projects/{project_id}/keys/{id} Delete a key
KeysApi keyShow GET /projects/{project_id}/keys/{id} Get a single key
KeysApi keyUpdate PATCH /projects/{project_id}/keys/{id} Update a key
KeysApi keysDelete DELETE /projects/{project_id}/keys Delete collection of keys
KeysApi keysList GET /projects/{project_id}/keys List keys
KeysApi keysSearch POST /projects/{project_id}/keys/search Search keys
KeysApi keysTag PATCH /projects/{project_id}/keys/tag Add tags to collection of keys
KeysApi keysUntag PATCH /projects/{project_id}/keys/untag Remove tags from collection of keys
LocalesApi localeCreate POST /projects/{project_id}/locales Create a locale
LocalesApi localeDelete DELETE /projects/{project_id}/locales/{id} Delete a locale
LocalesApi localeDownload GET /projects/{project_id}/locales/{id}/download Download a locale
LocalesApi localeShow GET /projects/{project_id}/locales/{id} Get a single locale
LocalesApi localeUpdate PATCH /projects/{project_id}/locales/{id} Update a locale
LocalesApi localesList GET /projects/{project_id}/locales List locales
MembersApi memberDelete DELETE /accounts/{account_id}/members/{id} Remove a user from the account
MembersApi memberShow GET /accounts/{account_id}/members/{id} Get single member
MembersApi memberUpdate PATCH /accounts/{account_id}/members/{id} Update a member
MembersApi memberUpdateSettings PATCH /projects/{project_id}/members/{id} Update a member's project settings
MembersApi membersList GET /accounts/{account_id}/members List members
OrdersApi orderConfirm PATCH /projects/{project_id}/orders/{id}/confirm Confirm an order
OrdersApi orderCreate POST /projects/{project_id}/orders Create a new order
OrdersApi orderDelete DELETE /projects/{project_id}/orders/{id} Cancel an order
OrdersApi orderShow GET /projects/{project_id}/orders/{id} Get a single order
OrdersApi ordersList GET /projects/{project_id}/orders List orders
ProjectsApi projectCreate POST /projects Create a project
ProjectsApi projectDelete DELETE /projects/{id} Delete a project
ProjectsApi projectShow GET /projects/{id} Get a single project
ProjectsApi projectUpdate PATCH /projects/{id} Update a project
ProjectsApi projectsList GET /projects List projects
ReleasesApi releaseCreate POST /accounts/{account_id}/distributions/{distribution_id}/releases Create a release
ReleasesApi releaseDelete DELETE /accounts/{account_id}/distributions/{distribution_id}/releases/{id} Delete a release
ReleasesApi releasePublish POST /accounts/{account_id}/distributions/{distribution_id}/releases/{id}/publish Publish a release
ReleasesApi releaseShow GET /accounts/{account_id}/distributions/{distribution_id}/releases/{id} Get a single release
ReleasesApi releaseUpdate PATCH /accounts/{account_id}/distributions/{distribution_id}/releases/{id} Update a release
ReleasesApi releasesList GET /accounts/{account_id}/distributions/{distribution_id}/releases List releases
ScreenshotMarkersApi screenshotMarkerCreate POST /projects/{project_id}/screenshots/{screenshot_id}/markers Create a screenshot marker
ScreenshotMarkersApi screenshotMarkerDelete DELETE /projects/{project_id}/screenshots/{screenshot_id}/markers Delete a screenshot marker
ScreenshotMarkersApi screenshotMarkerShow GET /projects/{project_id}/screenshots/{screenshot_id}/markers/{id} Get a single screenshot marker
ScreenshotMarkersApi screenshotMarkerUpdate PATCH /projects/{project_id}/screenshots/{screenshot_id}/markers Update a screenshot marker
ScreenshotMarkersApi screenshotMarkersList GET /projects/{project_id}/screenshots/{id}/markers List screenshot markers
ScreenshotsApi screenshotCreate POST /projects/{project_id}/screenshots Create a screenshot
ScreenshotsApi screenshotDelete DELETE /projects/{project_id}/screenshots/{id} Delete a screenshot
ScreenshotsApi screenshotShow GET /projects/{project_id}/screenshots/{id} Get a single screenshot
ScreenshotsApi screenshotUpdate PATCH /projects/{project_id}/screenshots/{id} Update a screenshot
ScreenshotsApi screenshotsList GET /projects/{project_id}/screenshots List screenshots
SpacesApi spaceCreate POST /accounts/{account_id}/spaces Create a Space
SpacesApi spaceDelete DELETE /accounts/{account_id}/spaces/{id} Delete Space
SpacesApi spaceShow GET /accounts/{account_id}/spaces/{id} Get Space
SpacesApi spaceUpdate PATCH /accounts/{account_id}/spaces/{id} Update Space
SpacesApi spacesList GET /accounts/{account_id}/spaces List Spaces
SpacesApi spacesProjectsCreate POST /accounts/{account_id}/spaces/{space_id}/projects Add Project
SpacesApi spacesProjectsDelete DELETE /accounts/{account_id}/spaces/{space_id}/projects/{id} Remove Project
SpacesApi spacesProjectsList GET /accounts/{account_id}/spaces/{space_id}/projects List Projects
StyleGuidesApi styleguideCreate POST /projects/{project_id}/styleguides Create a style guide
StyleGuidesApi styleguideDelete DELETE /projects/{project_id}/styleguides/{id} Delete a style guide
StyleGuidesApi styleguideShow GET /projects/{project_id}/styleguides/{id} Get a single style guide
StyleGuidesApi styleguideUpdate PATCH /projects/{project_id}/styleguides/{id} Update a style guide
StyleGuidesApi styleguidesList GET /projects/{project_id}/styleguides List style guides
TagsApi tagCreate POST /projects/{project_id}/tags Create a tag
TagsApi tagDelete DELETE /projects/{project_id}/tags/{name} Delete a tag
TagsApi tagShow GET /projects/{project_id}/tags/{name} Get a single tag
TagsApi tagsList GET /projects/{project_id}/tags List tags
TeamsApi teamCreate POST /accounts/{account_id}/teams Create a Team
TeamsApi teamDelete DELETE /accounts/{account_id}/teams/{team_id} Delete Team
TeamsApi teamShow GET /accounts/{account_id}/teams/{team_id} Get Team
TeamsApi teamUpdate PATCH /accounts/{account_id}/teams/{team_id} Update Team
TeamsApi teamsList GET /accounts/{account_id}/teams List Teams
TeamsApi teamsProjectsCreate POST /accounts/{account_id}/teams/{team_id}/projects Add Project
TeamsApi teamsProjectsDelete DELETE /accounts/{account_id}/teams/{team_id}/projects/{id} Remove Project
TeamsApi teamsSpacesCreate POST /accounts/{account_id}/teams/{team_id}/spaces Add Space
TeamsApi teamsSpacesDelete DELETE /accounts/{account_id}/teams/{team_id}/spaces/{id} Remove Space
TeamsApi teamsUsersCreate POST /accounts/{account_id}/teams/{team_id}/users Add User
TeamsApi teamsUsersDelete DELETE /accounts/{account_id}/teams/{team_id}/users/{id} Remove User
TranslationsApi translationCreate POST /projects/{project_id}/translations Create a translation
TranslationsApi translationExclude PATCH /projects/{project_id}/translations/{id}/exclude Exclude a translation from export
TranslationsApi translationInclude PATCH /projects/{project_id}/translations/{id}/include Revoke exclusion of a translation in export
TranslationsApi translationReview PATCH /projects/{project_id}/translations/{id}/review Review a translation
TranslationsApi translationShow GET /projects/{project_id}/translations/{id} Get a single translation
TranslationsApi translationUnverify PATCH /projects/{project_id}/translations/{id}/unverify Mark a translation as unverified
TranslationsApi translationUpdate PATCH /projects/{project_id}/translations/{id} Update a translation
TranslationsApi translationVerify PATCH /projects/{project_id}/translations/{id}/verify Verify a translation
TranslationsApi translationsByKey GET /projects/{project_id}/keys/{key_id}/translations List translations by key
TranslationsApi translationsByLocale GET /projects/{project_id}/locales/{locale_id}/translations List translations by locale
TranslationsApi translationsExclude PATCH /projects/{project_id}/translations/exclude Set exclude from export flag on translations selected by query
TranslationsApi translationsInclude PATCH /projects/{project_id}/translations/include Remove exlude from import flag from translations selected by query
TranslationsApi translationsList GET /projects/{project_id}/translations List all translations
TranslationsApi translationsReview PATCH /projects/{project_id}/translations/review Review translations selected by query
TranslationsApi translationsSearch POST /projects/{project_id}/translations/search Search translations
TranslationsApi translationsUnverify PATCH /projects/{project_id}/translations/unverify Mark translations selected by query as unverified
TranslationsApi translationsVerify PATCH /projects/{project_id}/translations/verify Verify translations selected by query
UploadsApi uploadCreate POST /projects/{project_id}/uploads Upload a new file
UploadsApi uploadShow GET /projects/{project_id}/uploads/{id} View upload details
UploadsApi uploadsList GET /projects/{project_id}/uploads List uploads
UsersApi showUser GET /user Show current User
VariablesApi variableCreate POST /projects/{project_id}/variables Create a variable
VariablesApi variableDelete DELETE /projects/{project_id}/variables/{name} Delete a variable
VariablesApi variableShow GET /projects/{project_id}/variables/{name} Get a single variable
VariablesApi variableUpdate PATCH /projects/{project_id}/variables/{name} Update a variable
VariablesApi variablesList GET /projects/{project_id}/variables List variables
VersionsHistoryApi versionShow GET /projects/{project_id}/translations/{translation_id}/versions/{id} Get a single version
VersionsHistoryApi versionsList GET /projects/{project_id}/translations/{translation_id}/versions List all versions
WebhooksApi webhookCreate POST /projects/{project_id}/webhooks Create a webhook
WebhooksApi webhookDelete DELETE /projects/{project_id}/webhooks/{id} Delete a webhook
WebhooksApi webhookShow GET /projects/{project_id}/webhooks/{id} Get a single webhook
WebhooksApi webhookTest POST /projects/{project_id}/webhooks/{id}/test Test a webhook
WebhooksApi webhookUpdate PATCH /projects/{project_id}/webhooks/{id} Update a webhook
WebhooksApi webhooksList GET /projects/{project_id}/webhooks List 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

[email protected]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.9%
  • Other 0.1%