curl "https://api.phrase.com/v2/projects/:project_id/jobs" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","name":"de","briefing":"de-DE","due_date":"2017-08-15","ticket_url":"https://example.atlassian.net/browse/FOO","tags":["myUploadTag"],"translation_key_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase jobs create \
--project_id <project_id> \
--data '{"branch":"my-feature-branch", "name":"de", "briefing":"de-DE", "due_date":"2017-08-15", "ticket_url":"https://example.atlassian.net/browse/FOO", "tags": ["myUploadTag"], "translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"]}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs"
payload = {
"name": "de",
"branch": "my-feature-branch",
"source_locale_id": "abcd1234cdef1234abcd1234cdef1234",
"briefing": "de-DE",
"due_date": "2017-08-15",
"review_due_date": "2017-08-16",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"tags": ["myUploadTag"],
"translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"target_locale_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"job_template_id": "abcd1234cdef1234abcd1234cdef1234",
"autotranslate": True,
"exclude_linked_child_keys": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'de',
branch: 'my-feature-branch',
source_locale_id: 'abcd1234cdef1234abcd1234cdef1234',
briefing: 'de-DE',
due_date: '2017-08-15',
review_due_date: '2017-08-16',
ticket_url: 'https://example.atlassian.net/browse/FOO',
tags: ['myUploadTag'],
translation_key_ids: ['abcd1234cdef1234abcd1234cdef1234'],
target_locale_ids: ['abcd1234cdef1234abcd1234cdef1234'],
job_template_id: 'abcd1234cdef1234abcd1234cdef1234',
autotranslate: true,
exclude_linked_child_keys: false
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phrase.com/v2/projects/{project_id}/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'de',
'branch' => 'my-feature-branch',
'source_locale_id' => 'abcd1234cdef1234abcd1234cdef1234',
'briefing' => 'de-DE',
'due_date' => '2017-08-15',
'review_due_date' => '2017-08-16',
'ticket_url' => 'https://example.atlassian.net/browse/FOO',
'tags' => [
'myUploadTag'
],
'translation_key_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'target_locale_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'job_template_id' => 'abcd1234cdef1234abcd1234cdef1234',
'autotranslate' => true,
'exclude_linked_child_keys' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/projects/{project_id}/jobs"
payload := strings.NewReader("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"review_due_date\": \"2017-08-16\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true,\n \"exclude_linked_child_keys\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phrase.com/v2/projects/{project_id}/jobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"review_due_date\": \"2017-08-16\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true,\n \"exclude_linked_child_keys\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"review_due_date\": \"2017-08-16\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true,\n \"exclude_linked_child_keys\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "626ea67628690c73ac86ac81eec2d185",
"name": "Translations for new Feature",
"briefing": "Some instructions for the translators",
"due_date": "2017-02-28T09:52:53Z",
"state": "completed",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"created_at": "2017-01-28T09:52:53Z",
"updated_at": "2017-01-28T09:52:53Z",
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
},
"owner": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe"
},
"job_tag_name": "Job_123",
"source_translations_updated_at": "2020-01-01T00:00:00Z",
"source_locale": {
"id": "abcd1234cdef1234abcd1234cdef1235",
"name": "de-DE",
"code": "de-DE"
},
"locales": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
],
"keys": [
{
"id": "dbcd1234cdef1234abcd1234cdef1234",
"name": "greeting.hello"
}
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Create a job
Create a new job.
curl "https://api.phrase.com/v2/projects/:project_id/jobs" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch","name":"de","briefing":"de-DE","due_date":"2017-08-15","ticket_url":"https://example.atlassian.net/browse/FOO","tags":["myUploadTag"],"translation_key_ids":["abcd1234cdef1234abcd1234cdef1234"]}' \
-H 'Content-Type: application/json'phrase jobs create \
--project_id <project_id> \
--data '{"branch":"my-feature-branch", "name":"de", "briefing":"de-DE", "due_date":"2017-08-15", "ticket_url":"https://example.atlassian.net/browse/FOO", "tags": ["myUploadTag"], "translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"]}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/jobs"
payload = {
"name": "de",
"branch": "my-feature-branch",
"source_locale_id": "abcd1234cdef1234abcd1234cdef1234",
"briefing": "de-DE",
"due_date": "2017-08-15",
"review_due_date": "2017-08-16",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"tags": ["myUploadTag"],
"translation_key_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"target_locale_ids": ["abcd1234cdef1234abcd1234cdef1234"],
"job_template_id": "abcd1234cdef1234abcd1234cdef1234",
"autotranslate": True,
"exclude_linked_child_keys": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'de',
branch: 'my-feature-branch',
source_locale_id: 'abcd1234cdef1234abcd1234cdef1234',
briefing: 'de-DE',
due_date: '2017-08-15',
review_due_date: '2017-08-16',
ticket_url: 'https://example.atlassian.net/browse/FOO',
tags: ['myUploadTag'],
translation_key_ids: ['abcd1234cdef1234abcd1234cdef1234'],
target_locale_ids: ['abcd1234cdef1234abcd1234cdef1234'],
job_template_id: 'abcd1234cdef1234abcd1234cdef1234',
autotranslate: true,
exclude_linked_child_keys: false
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/jobs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.phrase.com/v2/projects/{project_id}/jobs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'de',
'branch' => 'my-feature-branch',
'source_locale_id' => 'abcd1234cdef1234abcd1234cdef1234',
'briefing' => 'de-DE',
'due_date' => '2017-08-15',
'review_due_date' => '2017-08-16',
'ticket_url' => 'https://example.atlassian.net/browse/FOO',
'tags' => [
'myUploadTag'
],
'translation_key_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'target_locale_ids' => [
'abcd1234cdef1234abcd1234cdef1234'
],
'job_template_id' => 'abcd1234cdef1234abcd1234cdef1234',
'autotranslate' => true,
'exclude_linked_child_keys' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.phrase.com/v2/projects/{project_id}/jobs"
payload := strings.NewReader("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"review_due_date\": \"2017-08-16\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true,\n \"exclude_linked_child_keys\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.phrase.com/v2/projects/{project_id}/jobs")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"review_due_date\": \"2017-08-16\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true,\n \"exclude_linked_child_keys\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"de\",\n \"branch\": \"my-feature-branch\",\n \"source_locale_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"briefing\": \"de-DE\",\n \"due_date\": \"2017-08-15\",\n \"review_due_date\": \"2017-08-16\",\n \"ticket_url\": \"https://example.atlassian.net/browse/FOO\",\n \"tags\": [\n \"myUploadTag\"\n ],\n \"translation_key_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"target_locale_ids\": [\n \"abcd1234cdef1234abcd1234cdef1234\"\n ],\n \"job_template_id\": \"abcd1234cdef1234abcd1234cdef1234\",\n \"autotranslate\": true,\n \"exclude_linked_child_keys\": false\n}"
response = http.request(request)
puts response.read_body{
"id": "626ea67628690c73ac86ac81eec2d185",
"name": "Translations for new Feature",
"briefing": "Some instructions for the translators",
"due_date": "2017-02-28T09:52:53Z",
"state": "completed",
"ticket_url": "https://example.atlassian.net/browse/FOO",
"created_at": "2017-01-28T09:52:53Z",
"updated_at": "2017-01-28T09:52:53Z",
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
},
"owner": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"username": "joe.doe",
"name": "Joe Doe"
},
"job_tag_name": "Job_123",
"source_translations_updated_at": "2020-01-01T00:00:00Z",
"source_locale": {
"id": "abcd1234cdef1234abcd1234cdef1235",
"name": "de-DE",
"code": "de-DE"
},
"locales": [
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "English",
"code": "en-GB"
}
],
"keys": [
{
"id": "dbcd1234cdef1234abcd1234cdef1234",
"name": "greeting.hello"
}
]
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Body
tags of keys that should be included within the job.
Note: a tag matches every key currently carrying that tag, not just the ones you just tagged. For example, if hundreds of pre-existing keys already share the tag myUploadTag, adding it here pulls in every one of them, not only the key you just tagged. Use translation_key_ids to scope the job to specific keys instead.
["myUploadTag"]
id of a job template you would like to model the created job after. Any manually added parameters will take preference over template attributes. Mutually exclusive with target_locale_ids. The calling user must have read access to the template; if the template exists but is not accessible, the request returns 404.
"abcd1234cdef1234abcd1234cdef1234"
Response
Created
Was this page helpful?