Projects
The projects endpoint handles CRUD operations for projects. It is accessed through the following two URLs.
Getting a list of the projects you can access
URL: /projects/
GET
Return a list of the projects you have access to. This API call provides paginated items in sets of 500. You can specify how many items to receive (up to a maximum of 500) as follows:
$ curl -i -L --user api:<token> -X GET \
https://www.transifex.com/api/2/projects/?start=1&end=300
Project creation methods
URL: /projects/
POST
Create a new project. You must submit values for the name
, slug
, description
, and source_language_code
of the project as a JSON string. If your project is Open Source, you must also include a valid URL (e.g. https://www.transifex.com) for the field repository_url
. If your project is private, you should submit the field private
instead, which can be set to true or false.
Additionally, you can submit values for the following fields:
long_description
private
homepage
trans_instructions
tags
- comma separated tagsmaintainers
team
auto_join
license
fill_up_resources
repository_url
organization
archived
type
(1 for file-based projects, 2 for Transifex Live projects)
The only available characters for the slug field are alphanumeric ones, the underscore, and the dash.
The maintainers field is a list of comma-separated usernames like "username1, username2, username3". If it is not set, then the owner of the project will be also set as the maintainer of the project.
The source_language_code field specifies the source language that will be used for all resources in the project. A list of the supported languages and their respective codes can be found on our Languages page.
The available options for the license field are proprietary
, permissive_open_source
, and other_open_source
. If you do not specify a license, one will be automatically chosen based on whether the project is set to private or not.
If a project is denoted either as permissive_open_source or other_open_source, the field repository_url is mandatory and should contain a link to the public repository of the project to be created.
If the system should fill up resources automatically with 100% similar matches from the Translation Memory, the fill_up_resources
option should be set to true
.
The organization should be set to the slug of the organization that the new project will belong to. If you are an Administrator in only one organization, then this is optional.
The team field can be set if you want to reuse an existing team of the organization. If no team is passed, a new one will be created for the project automatically.
By setting the archived
boolean flag, organization administrators can archive an inactive project or restore an archived one.
Example:
The following POST call will attempt to create a project with the slug 'transifex' and fail, since there is an existing project with that slug:
$ curl -i -L --user api:<token> -X POST \
-d '{"slug":"transifex","name":"Transifex","source_language_code":"en","description":"Description", "private": true}' \
-H "Content-Type: application/json" https://www.transifex.com/api/2/projects/
HTTP/1.0 400 BAD REQUEST
...
{'slug': [u'Project with this Slug already exists.']}
So, in order to successfully create a project instance, the slug you will define in your API call should not be used by another project in Transifex - no matter the organization it belongs to.
Project instance methods
URL: /project/<project_slug>
GET
Return the fields slug
, name
, description
, and source_language_code
for the project of the specified slug in JSON format. If the keyword details
is used as a GET parameter, a more complete list of fields is returned. This includes the above fields as well as the following ones:
archived
- True if project is archived, otherwise False.long_description
homepage
created
trans_instructions
tags
team
- Integer that points to the Teamid
being used by the project.auto_join
maintainers
fill_up_resources
resources
- list of the resources of the project containing the fieldsslug
andname
.teams
- list of language codes for the Teams created for the project.
Example:
$ curl -i -L --user api:<token> -X GET \
https://www.transifex.com/api/2/project/transifex/?details
HTTP/1.1 200 OK
...
{
"name": "Transifex",
"slug": "transifex",
"description": "Social Localization Platform",
"created": "2009-04-21 08:12:16",
"tags": "translations,l10n,i18n",
"team": {
"id": 12345,
"name": "Transifex team"
},
"organization": {
"slug": "transifex"
},
"teams": [
"eu",
"lv",
...
],
"resources": [
{
"slug": "txc",
"name": "Transifex core"
},
...
],
}
PUT
Update the details for the specified project. Parameters should be given as a JSON-encoded string, like in the POST request above. The available fields are the same as those in the POST request above.
Example:
$ curl -i -L --user api:<token> -X PUT \
-d '{"name":"Transifex","description":"Description", "private": true, "maintainers": "nelefth,fotis.athineos,translator360"}' \
-H "Content-Type: application/json" https://www.transifex.com/api/2/project/transifex/
However, the field source_language_code
is not allowed, if the project has resources, since that would create issues with existing content already in the Transifex.
Also, it is currently not possible to modify the project slug through the API.
Example:
$ curl -i -L --user api:<token> -X PUT \
-d '{"slug":"transifex-foo"}' \
-H "Content-Type: application/json" https://www.transifex.com/api/2/project/transifex/
HTTP/1.0 400 BAD REQUEST
...
Field 'slug' is not allowed.
---
$ curl -i -L --user api:<token> -X PUT \
-d '{"source_language_code":"de"}' \
-H "Content-Type: application/json" https://www.transifex.com/api/2/project/transifex/
HTTP/1.0 400 BAD REQUEST
...
Field 'source_language_code' is not allowed.
DELETE
Delete a project with a specific slug
.
Example:
$ curl -i -L --user api:<token> -X DELETE \
https://www.transifex.com/api/2/project/transifex/
HTTP/1.1 204 NO CONTENT
...