Screenshots
The screenshots endpoint handles READ/UPDATE operations for screenshots in a project.
Screenshots are identified by an ID provided by Transifex.
Note
The screenshots endpoint is only available on the Premium plan and up.
You must authenticate with a token when calling these endpoints.
Getting list of screenshots
URL:
api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/
GET
This request is used to get a list of screenshots in a project. This API endpoint provides paginated items in sets of 100. Every response that includes paginated items also includes detailed info about pagination in response header. The pagination info is included in the Link header.
The response is a JSON list of screenshots in the project. For each screenshot, there is a dictionary with information about the screenshot:
id
- the unique id of the screenshotname
- the name of the screenshotmedia_url
- the URL of the screenshotthumb_url
- the URL of the screenshots' thumbnailcreated_by
- username of the uploadercreated
- timestamp of the creationmodified
- timestamp of modificationmapped_strings_count
- the number of strings mapped to this screenshot
Example:
curl -i --user api:<token> -X GET https://api.transifex.com/organizations/transifex/projects/transifex/context/screenshots/
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 05 Sep 2018 09:44:22 GMT
Content-Type: application/json
Content-Length: 38913
Connection: keep-alive
Vary: Accept-Encoding
X-Transifex-View: ContextMediaViewSet:list
X-Transifex-Project: transifex
Link: <https://api.transifex.com/organizations/transifex/projects/transifex/context/screenshots/?cursor=cD0xMDY3Nzc%3D>; rel="next"
X-Transifex-User: ninaelefth
Allow: GET, OPTIONS
X-Transifex-Organization: transifex
[
{
"id": 94376,
"name": "Home page",
"media_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_original",
"thumb_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_resized",
"created": "2017-02-28T20:25:18.195987Z",
"modified": "2017-02-28T20:25:18.196013Z",
"created_by": "diegobz",
"mapped_strings_count": 4
},
{
"id": 92525,
"name": "Screenshot 2016-11-08 12.21.21.png",
"media_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_original",
"thumb_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_resized",
"created": "2016-11-08T10:36:58.510259Z",
"modified": "2017-01-13T08:33:41.553153Z",
"created_by": "nbasili",
"mapped_strings_count": 16
}
]
Uploading a screenshot
URL: usermedia.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/
POST
The request is used to upload a screenshot to a project.
Example:
curl -i --user api:<token> -XPOST https://usermedia.transifex.com/organizations/transifex/projects/transifex/context/screenshots/ -v -F screenshot=@/Users/Thomas/homepage.png -v -F name="Home page"
HTTP/1.0 200 OK
...
{
"id": 94376,
"name": "Home page",
"media_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_original",
"thumb_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_resized",
"created": "2017-02-28T20:25:18.195987Z",
"modified": "2017-02-28T20:25:18.196013Z",
"created_by": "diegobz",
"mapped_strings_count": 0
}
Getting screenshot details
URL: api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/
GET
This request is used to get information about a screenshot.
Example:
curl -i --user api:<token> -X GET https://api.transifex.com/organizations/transifex/projects/transifex/context/screenshots/94376/
HTTP/1.0 200 OK
...
{
"id": 94376,
"name": "Home page",
"media_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_original",
"thumb_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_resized",
"created": "2017-02-28T20:25:18.195987Z",
"modified": "2017-02-28T20:25:18.196013Z",
"created_by": "diegobz",
"mapped_strings_count": 4
}
Updating a screenshot
URL: usermedia.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/
PATCH
This request is used to rename a screenshot or update the screenshot itself.
The allowed parameters are:
name
- the new name of the screenshotscreenshot
- the new screenshot
Example:
curl --user api:<token> -XPATCH https://usermedia.transifex.com/organizations/transifex/projects/transifex/context/screenshots/94376/ -v -F name="New home page"
HTTP/1.0 200 OK
...
{
"id": 94376,
"name": "New home page",
"media_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_original",
"thumb_url": "https://s3-eu-west-1.amazonaws.com/transifex-context/transifex/transifex/1cb3ff6c-65fa-4a41-8384-4eacaed7da3d_resized",
"created": "2017-02-28T20:25:18.195987Z",
"modified": "2017-02-28T20:25:18.196013Z",
"created_by": "diegobz",
"mapped_strings_count": 0
}
Deleting a screenshot
URL: api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/
DELETE
This request is used to delete a screenshot from a project.
Example:
curl -i --user api:<token> -X DELETE https://api.transifex.com/organizations/transifex/projects/tests-2/context/screenshots/95311/
HTTP/1.1 204 No Content
Getting a list of mapped strings
URL: api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/mapped_strings/
GET
This request is used to get all the mapped strings for a screenshot.
The response is a JSON list of strings mapped to the screenshot. For each mapped string, there is a dictionary with the following data:
source_string_hash
- the hash of the source string (learn how to calculate it here)resource_slug
- the slug of the resourcecoordinates
- coordinates of the position of the string from the top left corner and dimensions of the container area ({} if the string is not mapped to a specific position):x
y
width
height
source_string
- the source stringid
- the id of the mapping
Example:
curl -i --user api:<token> -X GET https://api.transifex.com/organizations/transifex/projects/tests-2/context/screenshots/95311/mapped_strings/
HTTP/1.1 200 OK
[
{
"source_string_hash":"701f39eae5ddd8534d42ef50209851ca",
"resource_slug":"my resource slug",
"coordinates":
{
"width":372,
"x":423,
"height":59,
"y":261
},
"source_string":"a source string example",
"id":6555
},
{
"source_string_hash":"5ec107918ccee4bed1b65f7cd02ffd83",
"resource_slug":"my resource slug",
"coordinates":
{
"width":372,
"x":36,
"height":25,
"y":116
},
"source_string":"another source string",
"id":6554
}
]
Mapping strings to a screenshot
URL: api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/mapped_strings/
POST
This request is used to map one or more strings to a screenshot. Note that while the coordinates attribute is required, you can leave the dictionary empty if you don't want to map a string to a specific position in the screenshot.
Example:
curl -i --user api:<token> -X POST https://api.transifex.com/organizations/transifex/projects/tests-2/context/screenshots/95311/mapped_strings/ -v -H "Content-Type: application/json" --data '[{"coordinates": {"height": 50, "width": 30, "x": 10, "y": 20}, "resource_slug": "a_resource_slug", "source_string_hash": "my_hash"}, {"coordinates": {}, "resource_slug": "a_resource_slug", "source_string_hash": "my_second_hash"}]'
HTTP/1.1 201 Created
[
{
"source_string_hash":"my_hash",
"resource_slug":"a_resource_slug",
"coordinates":
{
"width":30,
"x":10,
"height":50,
"y":20
},
"source_string":"my source string",
"id":6561
},
{
"source_string_hash":"my_second_hash",
"resource_slug":"a_resource_slug",
"coordinates":{},
"source_string":"another source string",
"id":6562
}
]
Unmapping strings from screenshot
URL: api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/mapped_strings/
DELETE
This request is used to unmap all strings from a screenshot.
Example:
curl -i --user api:<token> -X DELETE https://api.transifex.com/organizations/transifex/projects/tests-2/context/screenshots/95311/mapped_strings/
HTTP/1.1 204 No Content
Unmapping a single string
URL: api.transifex.com/organizations/<organization_slug>/projects/<project_slug>/context/screenshots/<screenshot_id>/mapped_strings/<id>/
DELETE
This request is used to unmap a specific string from a screenshot.
Example:
curl -i --user api:<token> -X DELETE https://api.transifex.com/organizations/transifex/projects/tests-2/context/screenshots/95311/mapped_strings/1234/
HTTP/1.1 204 No Content