curl --request PATCH \
--url https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"owner_id": "<string>",
"export_triggers": [],
"export_schedule": {
"time": "09:00",
"time_zone": "Europe/Berlin",
"days_of_week": "1,3",
"day_of_month": 123,
"cron_schedule": "0 9 * * 1"
}
}
'import requests
url = "https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}"
payload = {
"name": "<string>",
"owner_id": "<string>",
"export_triggers": [],
"export_schedule": {
"time": "09:00",
"time_zone": "Europe/Berlin",
"days_of_week": "1,3",
"day_of_month": 123,
"cron_schedule": "0 9 * * 1"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
owner_id: '<string>',
export_triggers: [],
export_schedule: {
time: '09:00',
time_zone: 'Europe/Berlin',
days_of_week: '1,3',
day_of_month: 123,
cron_schedule: '0 9 * * 1'
}
})
};
fetch('https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}', 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/accounts/{account_id}/repo_syncs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'owner_id' => '<string>',
'export_triggers' => [
],
'export_schedule' => [
'time' => '09:00',
'time_zone' => 'Europe/Berlin',
'days_of_week' => '1,3',
'day_of_month' => 123,
'cron_schedule' => '0 9 * * 1'
]
]),
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/accounts/{account_id}/repo_syncs/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"owner_id\": \"<string>\",\n \"export_triggers\": [],\n \"export_schedule\": {\n \"time\": \"09:00\",\n \"time_zone\": \"Europe/Berlin\",\n \"days_of_week\": \"1,3\",\n \"day_of_month\": 123,\n \"cron_schedule\": \"0 9 * * 1\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"owner_id\": \"<string>\",\n \"export_triggers\": [],\n \"export_schedule\": {\n \"time\": \"09:00\",\n \"time_zone\": \"Europe/Berlin\",\n \"days_of_week\": \"1,3\",\n \"day_of_month\": 123,\n \"cron_schedule\": \"0 9 * * 1\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"owner_id\": \"<string>\",\n \"export_triggers\": [],\n \"export_schedule\": {\n \"time\": \"09:00\",\n \"time_zone\": \"Europe/Berlin\",\n \"days_of_week\": \"1,3\",\n \"day_of_month\": 123,\n \"cron_schedule\": \"0 9 * * 1\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd1234cdef1234abcd1234cdef1234",
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
},
"provider": "github",
"enabled": true,
"auto_import": true,
"repo_name": "organization/repo",
"created_at": "2015-01-28T09:52:53Z",
"last_import_at": "2015-01-28T09:52:53Z",
"last_export_at": "2015-01-28T09:52:53Z"
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Update a repo sync
Update settings for an existing Repo Sync. Sending owner_id, export_triggers, or export_schedule requires the caller to have manage_github_sync? permission on the project (returns 403 otherwise). Sending export_triggers or export_schedule when the automatic export feature is not enabled for the account returns 422.
curl --request PATCH \
--url https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id} \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"owner_id": "<string>",
"export_triggers": [],
"export_schedule": {
"time": "09:00",
"time_zone": "Europe/Berlin",
"days_of_week": "1,3",
"day_of_month": 123,
"cron_schedule": "0 9 * * 1"
}
}
'import requests
url = "https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}"
payload = {
"name": "<string>",
"owner_id": "<string>",
"export_triggers": [],
"export_schedule": {
"time": "09:00",
"time_zone": "Europe/Berlin",
"days_of_week": "1,3",
"day_of_month": 123,
"cron_schedule": "0 9 * * 1"
}
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
owner_id: '<string>',
export_triggers: [],
export_schedule: {
time: '09:00',
time_zone: 'Europe/Berlin',
days_of_week: '1,3',
day_of_month: 123,
cron_schedule: '0 9 * * 1'
}
})
};
fetch('https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}', 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/accounts/{account_id}/repo_syncs/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'owner_id' => '<string>',
'export_triggers' => [
],
'export_schedule' => [
'time' => '09:00',
'time_zone' => 'Europe/Berlin',
'days_of_week' => '1,3',
'day_of_month' => 123,
'cron_schedule' => '0 9 * * 1'
]
]),
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/accounts/{account_id}/repo_syncs/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"owner_id\": \"<string>\",\n \"export_triggers\": [],\n \"export_schedule\": {\n \"time\": \"09:00\",\n \"time_zone\": \"Europe/Berlin\",\n \"days_of_week\": \"1,3\",\n \"day_of_month\": 123,\n \"cron_schedule\": \"0 9 * * 1\"\n }\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"owner_id\": \"<string>\",\n \"export_triggers\": [],\n \"export_schedule\": {\n \"time\": \"09:00\",\n \"time_zone\": \"Europe/Berlin\",\n \"days_of_week\": \"1,3\",\n \"day_of_month\": 123,\n \"cron_schedule\": \"0 9 * * 1\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/accounts/{account_id}/repo_syncs/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"owner_id\": \"<string>\",\n \"export_triggers\": [],\n \"export_schedule\": {\n \"time\": \"09:00\",\n \"time_zone\": \"Europe/Berlin\",\n \"days_of_week\": \"1,3\",\n \"day_of_month\": 123,\n \"cron_schedule\": \"0 9 * * 1\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd1234cdef1234abcd1234cdef1234",
"project": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "My Android Project",
"main_format": "xml",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
},
"provider": "github",
"enabled": true,
"auto_import": true,
"repo_name": "organization/repo",
"created_at": "2015-01-28T09:52:53Z",
"last_import_at": "2015-01-28T09:52:53Z",
"last_export_at": "2015-01-28T09:52:53Z"
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Body
Replaces the current set of automatic export triggers. Requires manage_github_sync? permission on the project and the automatic export feature to be enabled for the account. Accepted values: schedule, branch_merged, job_completed.
schedule, branch_merged, job_completed Response
OK
Events that trigger an automatic export. Only present when the automatic export feature is enabled for the account. Possible values: schedule (runs on the configured schedule), branch_merged (runs when a branch is merged in the connected repository), job_completed (runs when a translation job completes in the project).
schedule, branch_merged, job_completed Was this page helpful?