Help
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 informations 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.
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 respond a JSON Hash containing the URL to the invitation. The invitation should be immediately available under the “Users” tab of your project.
Response example:
{"invitation_url":"https://webtranslateit.com/en/invitations/team_79cfd92737c484f67a9870e0b9d7294bbe989ca8"}
🔗Implementation Example in Ruby:
require 'net/http'
require 'json'
http = Net::HTTP.new('webtranslateit.com', 443)
http.use_ssl = true
request = Net::HTTP::Post.new('/api/organizations/:api_token/teams/:team_id/members', { 'Content-Type' => 'application/json' })
request.body = {email: 'test@test.com', role: 'translator', locale: 'fr', proofreader: 'true', super_proofreader: 'true', personal_message: "Hello there, here's an application to translate our project on WebTranslateIt. Thank you in advance!", name: 'Testy Mc Testerson' }.to_json
response = http.request(request)
puts JSON.parse(response.body)['invitation_url'] # => https://webtranslateit.com/en/invitations/team_26bfecbfeb8c5ccae3663fae591d840c2c1d71db
🔗Implementation Example in PHP:
<?php
$api_key = "sekret";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://webtranslateit.com/api/organizations/" . $api_key . "/teams/" . $team_id . "/members");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("email" => "test@test.com", "role" => "translator", "locale" => "fr", "proofreader" => "true", "super_proofreader" => "true", "personal_message" => "Hello there, here's an invitation to translate our project on WebTranslateIt. Thank you in advance!", "name" => "Testy Mc Testerson"));
$response = curl_exec($ch);
print_r($response);
curl_close($ch);
?>
🔗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_api_key/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.
🔗Implementation Example in Ruby:
require 'net/http'
require 'json'
http = Net::HTTP.new('webtranslateit.com', 443)
http.use_ssl = true
request = Net::HTTP::Delete.new('/api/organizations/:api_token/teams/:team_id/members/:member_id', { 'Content-Type' => 'application/json' })
response = http.request(request)
🔗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/projects/: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 reprentation 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.
🔗Example response
Success:
{"team_member":{"type":"membership","id":527,"avatar":"https://secure.gravatar.com/avatar/d0ed69be1d61caf4ddbdc74ce27788ff.png?d=identicon&r=PG","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."]}}
🔗Implementation Example in Ruby:
require 'net/http'
require 'json'
http = Net::HTTP.new('webtranslateit.com', 443)
http.use_ssl = true
request = Net::HTTP::Put.new('/api/organizations/:api_token/teams/:team_id/members/:team_member_id', { 'Content-Type' => 'application/json' })
request.body = {proofreader: true, super_proofreader: false }.to_json
response = http.request(request)