curl "https://api.phrase.com/v2/projects/:project_id/screenshots/:screenshot_id/markers" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch", "key_id":"abcd1234abcd1234abcd1234abcd1234","presentation":"{ \"x\": 100, \"y\": 100, \"w\": 100, \"h\": 100 }"}' \
-H 'Content-Type: application/json'phrase screenshot_markers create \
--project_id <project_id> \
--screenshot_id <screenshot_id> \
--data '{"branch":"my-feature-branch", "key_id":"abcd1234abcd1234abcd1234abcd1234", "presentation": "{ "x": 100, "y": 100, "w": 100, "h": 100 }"}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/screenshots/{screenshot_id}/markers"
payload = {
"key_id": "abcd1234abcd1234abcd1234abcd1234",
"branch": "my-feature-branch",
"presentation": "{ \"x\": 100, \"y\": 100, \"w\": 100, \"h\": 100 }"
}
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({
key_id: 'abcd1234abcd1234abcd1234abcd1234',
branch: 'my-feature-branch',
presentation: '{ "x": 100, "y": 100, "w": 100, "h": 100 }'
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/screenshots/{screenshot_id}/markers', 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}/screenshots/{screenshot_id}/markers",
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([
'key_id' => 'abcd1234abcd1234abcd1234abcd1234',
'branch' => 'my-feature-branch',
'presentation' => '{ "x": 100, "y": 100, "w": 100, "h": 100 }'
]),
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}/screenshots/{screenshot_id}/markers"
payload := strings.NewReader("{\n \"key_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"branch\": \"my-feature-branch\",\n \"presentation\": \"{ \\\"x\\\": 100, \\\"y\\\": 100, \\\"w\\\": 100, \\\"h\\\": 100 }\"\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}/screenshots/{screenshot_id}/markers")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"key_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"branch\": \"my-feature-branch\",\n \"presentation\": \"{ \\\"x\\\": 100, \\\"y\\\": 100, \\\"w\\\": 100, \\\"h\\\": 100 }\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/screenshots/{screenshot_id}/markers")
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 \"key_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"branch\": \"my-feature-branch\",\n \"presentation\": \"{ \\\"x\\\": 100, \\\"y\\\": 100, \\\"w\\\": 100, \\\"h\\\": 100 }\"\n}"
response = http.request(request)
puts response.read_body{
"id": "d2e056aa9e70b01121f41693e344f5ee",
"presentation": {
"x": 10,
"y": 10,
"w": 10,
"h": 10
},
"presentation_type": "default",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"translation_key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "home.index.headline",
"description": "My description for this key...",
"name_hash": "1b31d2580ce324f246f66b3be00ed399",
"plural": false,
"tags": [
"awesome-feature",
"needs-proofreading"
],
"data_type": "string",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Create a screenshot marker
Create a new screenshot marker.
curl "https://api.phrase.com/v2/projects/:project_id/screenshots/:screenshot_id/markers" \
-u USERNAME_OR_ACCESS_TOKEN \
-X POST \
-d '{"branch":"my-feature-branch", "key_id":"abcd1234abcd1234abcd1234abcd1234","presentation":"{ \"x\": 100, \"y\": 100, \"w\": 100, \"h\": 100 }"}' \
-H 'Content-Type: application/json'phrase screenshot_markers create \
--project_id <project_id> \
--screenshot_id <screenshot_id> \
--data '{"branch":"my-feature-branch", "key_id":"abcd1234abcd1234abcd1234abcd1234", "presentation": "{ "x": 100, "y": 100, "w": 100, "h": 100 }"}' \
--access_token <token>import requests
url = "https://api.phrase.com/v2/projects/{project_id}/screenshots/{screenshot_id}/markers"
payload = {
"key_id": "abcd1234abcd1234abcd1234abcd1234",
"branch": "my-feature-branch",
"presentation": "{ \"x\": 100, \"y\": 100, \"w\": 100, \"h\": 100 }"
}
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({
key_id: 'abcd1234abcd1234abcd1234abcd1234',
branch: 'my-feature-branch',
presentation: '{ "x": 100, "y": 100, "w": 100, "h": 100 }'
})
};
fetch('https://api.phrase.com/v2/projects/{project_id}/screenshots/{screenshot_id}/markers', 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}/screenshots/{screenshot_id}/markers",
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([
'key_id' => 'abcd1234abcd1234abcd1234abcd1234',
'branch' => 'my-feature-branch',
'presentation' => '{ "x": 100, "y": 100, "w": 100, "h": 100 }'
]),
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}/screenshots/{screenshot_id}/markers"
payload := strings.NewReader("{\n \"key_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"branch\": \"my-feature-branch\",\n \"presentation\": \"{ \\\"x\\\": 100, \\\"y\\\": 100, \\\"w\\\": 100, \\\"h\\\": 100 }\"\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}/screenshots/{screenshot_id}/markers")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"key_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"branch\": \"my-feature-branch\",\n \"presentation\": \"{ \\\"x\\\": 100, \\\"y\\\": 100, \\\"w\\\": 100, \\\"h\\\": 100 }\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.phrase.com/v2/projects/{project_id}/screenshots/{screenshot_id}/markers")
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 \"key_id\": \"abcd1234abcd1234abcd1234abcd1234\",\n \"branch\": \"my-feature-branch\",\n \"presentation\": \"{ \\\"x\\\": 100, \\\"y\\\": 100, \\\"w\\\": 100, \\\"h\\\": 100 }\"\n}"
response = http.request(request)
puts response.read_body{
"id": "d2e056aa9e70b01121f41693e344f5ee",
"presentation": {
"x": 10,
"y": 10,
"w": 10,
"h": 10
},
"presentation_type": "default",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z",
"translation_key": {
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "home.index.headline",
"description": "My description for this key...",
"name_hash": "1b31d2580ce324f246f66b3be00ed399",
"plural": false,
"tags": [
"awesome-feature",
"needs-proofreading"
],
"data_type": "string",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
}{
"message": "Validation Failed",
"errors": [
{
"resource": "Resource",
"field": "name",
"message": "can't be blank"
}
]
}Authorizations
Enter your token in the format token TOKEN
Headers
Two-Factor-Authentication token (optional)
Body
Specify the Key ID which should be highlighted on the specified screenshot. The Key must belong to the project.
"abcd1234abcd1234abcd1234abcd1234"
specify the branch to use
"my-feature-branch"
Presentation details of the screenshot marker in JSON format.
Each Screenshot Marker is represented as a rectangular shaped highlight box with the name of the specified Key attached. You can specify the marker position on the screenshot (x-axis and y-axis in pixels) from the top left corner of the screenshot and the dimensions of the marker itself (w and h in pixels).
"{ \"x\": 100, \"y\": 100, \"w\": 100, \"h\": 100 }"
Response
Created
Coordinates and size of the marker on the screenshot, in pixels.
Show child attributes
Show child attributes
Marker presentation style. The default value is default.
Show child attributes
Show child attributes
{
"id": "abcd1234cdef1234abcd1234cdef1234",
"name": "home.index.headline",
"description": "My description for this key...",
"name_hash": "1b31d2580ce324f246f66b3be00ed399",
"plural": false,
"use_ordinal_rules": false,
"tags": ["awesome-feature", "needs-proofreading"],
"data_type": "string",
"created_at": "2015-01-28T09:52:53Z",
"updated_at": "2015-01-28T09:52:53Z"
}
Was this page helpful?