Documentation
API
Team Member API
The TeamMember API is composed of 4 endpoints:
- List Team Members
- Create Team Member - create an invitation to the Team
- Remove Team Member or Invitation - remove a Team Member from the Team
- Update Team Member or Invitation - update a Team Member
List Team Members
This endpoint is accessible by the read-only or read-write Organization API key which you can find in your organization settings. It returns information about your Team:
- A list of Team members.
The call should be made using a GET request.
/api/organizations/:organization_token/teams/:team_id/members.format [GET]
Where :team_id is the ID of the Team that can be gotten on the Organization API. format is one of xml, json or yaml or csv.
Parameters:
filter: can be one ofmembership,invitationor blank. Defaults to blank if left blank. Filters the list of team members by invitations or memberships.
/api/organizations/:organization_token/teams/:team_id/members.jsoncurl "https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members.json"
const response = await fetch(
'https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members.json'
)
const members = await response.json()
import requests
response = requests.get(
"https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN"
"/teams/1/members.json"
)
members = response.json()
require 'net/http'
require 'json'
uri = URI('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members.json')
members = JSON.parse(Net::HTTP.get(uri))
<?php
$ch = curl_init('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members.json');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$members = json_decode(curl_exec($ch), true);
curl_close($ch);
Data structure in JSON:
[{
"type": "membership",
"id": 4,
"user_id": 1,
"email": "email@webtranslateit.com",
"name": "FirstName LastName",
"role": "manager",
"locale": null,
"status": "",
"proofreader": true,
"super_proofreader": true,
"member_since": "2017-04-03T07:58:49Z",
"avatar": "https://secure.gravatar.com/avatar/1961fef04b12f9366acd7c0f8ce0297b.png?d=identicon&r=PG&s=200"
}, {
"type": "invitation",
"id": 8,
"user_id": 2,
"email": "chonchon@webtranslateit.com",
"name": "Chonchon",
"role": "manager",
"locale": null,
"status": "",
"proofreader": true,
"super_proofreader": true,
"member_since": "2017-04-03T08:00:10Z",
"avatar": "https://secure.gravatar.com/avatar/bad9247edfb251a4165fc45ca88655b7.png?d=identicon&r=PG&s=200"
}]
Create Team Member
This endpoint is only accessible by the Private Organization API key which you can find in your organization settings and creates an invitation request to a user in the Team.
The call should be made using a POST request.
/api/organizations/:organization_token/teams/:team_id/members [POST]
Parameters:
email: the e-mail address of the person to invite on the project.role: can be one oftranslator,manager,language_coordinatororobserver. Defaults totranslatorif left blank.proofreader: allows the user to proofread other people’s translations. Can be one oftrueorfalse. Defaults totrueif left blank.super_proofreader: allows the user to proofread her own translations. Can be one oftrueorfalse. Defaults totrueif left blank. Can’t betrueifproofreaderoption is set tofalse.locale: code of the locale to assign the translator or language coordinator to (optional for managers and observers).personal_message: Personal message that will be sent along with the invitation e-mail (optional).name: The name of the person invited. Used in the invitation e-mail. (optional).
If everything goes well, the server should respond with 201 Created in the response headers. The response body should contain a JSON Hash containing the URL to the invitation. The invitation should be immediately available under the “Users” tab of your project.
/api/organizations/:organization_token/teams/:team_id/memberscurl -X POST "https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members" \
-H "Content-Type: application/json" \
-d '{
"email": "translator@example.com",
"role": "translator",
"locale": "fr"
}'
const response = await fetch(
'https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
email: 'translator@example.com',
role: 'translator',
locale: 'fr'
})
}
)
const { invitation_url: invitationUrl } = await response.json()
import requests
response = requests.post(
"https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members",
json={
"email": "translator@example.com",
"role": "translator",
"locale": "fr",
},
)
invitation_url = response.json()["invitation_url"]
require 'net/http'
require 'json'
uri = URI('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members')
response = Net::HTTP.post(uri, {
email: 'translator@example.com',
role: 'translator',
locale: 'fr'
}.to_json, 'Content-Type' => 'application/json')
invitation_url = JSON.parse(response.body)['invitation_url']
<?php
$ch = curl_init('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'email' => 'translator@example.com',
'role' => 'translator',
'locale' => 'fr',
]));
$invitationUrl = json_decode(curl_exec($ch), true)['invitation_url'];
curl_close($ch);
Response example:
{"invitation_url":"https://webtranslateit.com/en/invitations/team_79cfd92737c484f67a9870e0b9d7294bbe989ca8"}
Remove Team Member or Invitation
This endpoint is only accessible by the read-write Organization API key and cancels an invitation or removes a Team Member.
/api/organizations/:organization_token/teams/:team_id/members/:member_id [DELETE]
If everything goes well, the server should respond with 202 Accepted in the response headers, and nothing in the body.
/api/organizations/:organization_token/teams/:team_id/members/:member_idcurl -X DELETE "https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527"
await fetch(
'https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527',
{ method: 'DELETE' }
)
import requests
requests.delete(
"https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN"
"/teams/1/members/527"
)
require 'net/http'
uri = URI('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527')
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request(Net::HTTP::Delete.new(uri))
end
<?php
$ch = curl_init('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_exec($ch);
curl_close($ch);
Update Team Member or Invitation
This endpoint is only accessible by the read-write Organization API key and updates a Team Member or a Team Invitation.
/api/organizations/:organization_token/teams/:team_id/members/:team_member_id [PATCH]
If everything goes well, the server should respond with 202 Accepted in the response headers. The body should contain a JSON representation of the team member. If the membership fails to be approved a JSON representation of the error will be returned in the body.
Optional parameters:
locale: code of the locale to assign the user to.proofreader: sets or unsets proofreading rights to the member. If set totruethe user will be able to proofread other people’s translations. Can be one oftrueorfalse. Defaults to whatever value was set by the membership if left blank.super_proofreader: sets or unsets super proofreading rights to the member. If set totruethe user will be able to proofread her own translations. Can be one oftrueorfalse. Defaults to whatever value was set by the membership if left blank.
/api/organizations/:organization_token/teams/:team_id/members/:team_member_idcurl -X PATCH "https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527" \
-H "Content-Type: application/json" \
-d '{ "proofreader": true, "super_proofreader": false }'
const response = await fetch(
'https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527',
{
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ proofreader: true, super_proofreader: false })
}
)
// `team_member` comes back as a JSON string, so it needs a second parse.
const teamMember = JSON.parse((await response.json()).team_member)
import json
import requests
response = requests.patch(
"https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN"
"/teams/1/members/527",
json={"proofreader": True, "super_proofreader": False},
)
# `team_member` comes back as a JSON string, so it needs a second parse.
team_member = json.loads(response.json()["team_member"])
require 'net/http'
require 'json'
uri = URI('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527')
request = Net::HTTP::Patch.new(uri, 'Content-Type' => 'application/json')
request.body = {proofreader: true, super_proofreader: false}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) { |http| http.request(request) }
# `team_member` comes back as a JSON string, so it needs a second parse.
team_member = JSON.parse(JSON.parse(response.body)['team_member'])
<?php
$ch = curl_init('https://webtranslateit.com/api/organizations/ORGANIZATION_TOKEN/teams/1/members/527');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'proofreader' => true,
'super_proofreader' => false,
]));
// `team_member` comes back as a JSON string, so it needs a second parse.
$teamMember = json_decode(json_decode(curl_exec($ch), true)['team_member'], true);
curl_close($ch);
Example response
Success. Note that team_member holds the team member encoded as a JSON string, not a nested
object, so it needs a second parse — that is what the examples above do:
{"team_member":"{\"type\":\"membership\",\"id\":527,\"email\":\"edouard@webtranslateit.com\",\"name\":\"Edouard Briere\",\"role\":\"manager\",\"locale\":\"fr\",\"proofreader\":true,\"super_proofreader\":true,\"member_since\":\"2010-02-09T23:23:11Z\"}"}
Failure:
{"error":"Problem saving membership","request":"https://webtranslateit.com/api/organizations/43847jdhsjh19289/teams/1/members/527","errors":{"proofreader":["Super proofreaders require the user have proofreading rights too. Add proofreading rights in order to save this membership."]}}