Difference between revisions of "Command Center API Reference"

From Lingoport Wiki
Jump to: navigation, search
(List Command Center users)
Line 7: Line 7:
   
 
Example:
 
Example:
curl "http://localhost:8080/command-center/api/listprojects" -d '{"username":"figmaAPI","token":"CTMNzj**********CP"}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/listprojects" -d '{"username":"APIuser","token":"CTMNzj**********CP"}' --header "Content-Type: application/json"
   
 
or
 
or
Line 14: Line 14:
 
'''listprojects.json''':
 
'''listprojects.json''':
 
{
 
{
"username":"figmaAPI",
+
"username":"APIuser",
 
"token":"CTMNzj**********CP"
 
"token":"CTMNzj**********CP"
 
}
 
}
Line 25: Line 25:
   
 
Example:
 
Example:
curl "http://localhost:8080/command-center/api/getStatus" -d '{"username":"figmaAPI","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/getStatus" -d '{"username":"APIuser","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}' --header "Content-Type: application/json"
   
 
or
 
or
Line 32: Line 32:
 
'''getStatus.json:'''
 
'''getStatus.json:'''
 
{
 
{
"username":"figmaAPI",
+
"username":"APIuser",
 
"token":"CTMNzj**********CP",
 
"token":"CTMNzj**********CP",
 
"source":{
 
"source":{
Line 48: Line 48:
   
 
Example:
 
Example:
curl "http://localhost:8080/command-center/api/translate" -d '{"username":"figmaAPI","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/translate" -d '{"username":"APIuser","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}' --header "Content-Type: application/json"
   
 
or
 
or
Line 55: Line 55:
 
'''translate.json:'''
 
'''translate.json:'''
 
{
 
{
"username":"figmaAPI",
+
"username":"APIuser",
 
"token":"CTMNzj**********CP",
 
"token":"CTMNzj**********CP",
 
"source":{
 
"source":{
Line 71: Line 71:
   
 
Example:
 
Example:
curl "http://localhost:8080/command-center/api/pseudoloc" -d '{"username":"figmaAPI","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/pseudoloc" -d '{"username":"APIuser","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}' --header "Content-Type: application/json"
   
 
or
 
or
Line 78: Line 78:
 
'''project.json:'''
 
'''project.json:'''
 
{
 
{
"username":"figmaAPI",
+
"username":"APIuser",
 
"token":"CTMNzj**********CP",
 
"token":"CTMNzj**********CP",
 
"source":{
 
"source":{
Line 101: Line 101:
 
For a target repository name https://github.com/Lingoport/Command-Center, branch 'liliDev', with a template called '''Lingoport Command-Center dev''' in Command Center using https://github.com, the following call would be make:
 
For a target repository name https://github.com/Lingoport/Command-Center, branch 'liliDev', with a template called '''Lingoport Command-Center dev''' in Command Center using https://github.com, the following call would be make:
   
curl "http://localhost:8080/command-center/api/createFromTemplateProject" -d '{"username":"figmaAPI","token":"CTMNzj**********CP","source": {"group_name": "Lingoport","project_name": "Command-Center","module_name": "dev"},"target": {"group_name":"Lingoport","project_name": "Command-Center","module_name": "liliDev"}}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/createFromTemplateProject" -d '{"username":"APIuser","token":"CTMNzj**********CP","source": {"group_name": "Lingoport","project_name": "Command-Center","module_name": "dev"},"target": {"group_name":"Lingoport","project_name": "Command-Center","module_name": "liliDev"}}' --header "Content-Type: application/json"
   
 
or
 
or
Line 109: Line 109:
 
'''dupProject.json''':
 
'''dupProject.json''':
 
{
 
{
"username":"figmaAPI",
+
"username":"APIuser",
 
"token":"CTMNzj**********CP",
 
"token":"CTMNzj**********CP",
 
"source":{
 
"source":{
Line 138: Line 138:
   
 
Example:
 
Example:
curl "http://localhost:8080/command-center/api/getUserList" -d '{"role": "developer","username":"figmaAPI","token":"CTMNzj**********CP"}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/getUserList" -d '{"role": "developer","username":"APIuser","token":"CTMNzj**********CP"}' --header "Content-Type: application/json"
   
 
or
 
or
Line 146: Line 146:
 
{
 
{
 
"role": "developer",
 
"role": "developer",
"username":"figmaAPI",
+
"username":"APIuser",
 
"token":"CTMNzj**********CP"
 
"token":"CTMNzj**********CP"
 
}
 
}
Line 157: Line 157:
   
 
Example:
 
Example:
curl "http://localhost:8080/command-center/api/assignUsersToTeam" -d '{"team": "Dev","username":"figmaAPI","token":"CTMNzj**********CP", "userList":"4,5,7,19"}' --header "Content-Type: application/json"
+
curl "http://localhost:8080/command-center/api/assignUsersToTeam" -d '{"team": "Dev","username":"APIuser","token":"CTMNzj**********CP", "userList":"4,5,7,19"}' --header "Content-Type: application/json"
   
 
or
 
or

Revision as of 16:01, 17 September 2024

Introduction

List Command Center projects

 curl "COMMAND_CENTER_URL/api/listprojects" -d '{"username":"API_USER","token":"API_TOKEN"}'  --header "Content-Type: application/json"

Example:

 curl "http://localhost:8080/command-center/api/listprojects" -d '{"username":"APIuser","token":"CTMNzj**********CP"}'  --header "Content-Type: application/json"

or

 curl "https://dockertest2.lingoport.io/command-center/api/listprojects" -d @listprojects.json --header "Content-Type: application/json"
 listprojects.json:
 {
  "username":"APIuser",
  "token":"CTMNzj**********CP"
 }

Command Center Project Status

 curl "COMMAND_CENTER_URL/api/getStatus" -d '{"username":"API_USER","token":"API_TOKEN", "source":{"group_name": "GROUP","project_name": "PROJECT","module_name": "MODULE"}}'  --header "Content-Type: application/json"


Example:

 curl "http://localhost:8080/command-center/api/getStatus" -d '{"username":"APIuser","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}'  --header "Content-Type: application/json"

or

 curl "http://localhost:8080/command-center/api/getStatus" -d @getStatus.json  --header "Content-Type: application/json"
 getStatus.json: 
 {
    "username":"APIuser",
    "token":"CTMNzj**********CP",
    "source":{
        "group_name": "Lingport",
        "project_name": "CET-WorldWindExplorer",
        "module_name": "lili"
     }
 }

Command Center Translate

 curl "COMMAND_CENTER_URL/api/translate" -d '{"username":"API_USER","token":"API_TOKEN", "source":{"group_name": "GROUP","project_name": "PROJECT","module_name": "MODULE"}}'  --header "Content-Type: application/json"


Example:

 curl "http://localhost:8080/command-center/api/translate" -d '{"username":"APIuser","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}'  --header "Content-Type: application/json"

or

 curl "http://localhost:8080/command-center/api/translate" -d @translate.json  --header "Content-Type: application/json"
 translate.json: 
 {
    "username":"APIuser",
    "token":"CTMNzj**********CP",
    "source":{
        "group_name": "Lingport",
        "project_name": "CET-WorldWindExplorer",
        "module_name": "lili"
     }
 }

Pseudo-localize a Command Center Project

 curl "COMMAND_CENTER_URL/api/pseudoloc" -d '{"username":"API_USER","token":"API_TOKEN", "source":{"group_name": "GROUP","project_name": "PROJECT","module_name": "MODULE"}}'  --header "Content-Type: application/json"


Example:

 curl "http://localhost:8080/command-center/api/pseudoloc" -d '{"username":"APIuser","token":"CTMNzj**********CP", "source":{"group_name": "Lingoport","project_name": "CET-WorldWindExplorer","module_name": "lili"}}'  --header "Content-Type: application/json"

or

 curl "http://localhost:8080/command-center/api/pseudoloc" -d @project.json  --header "Content-Type: application/json"
 project.json: 
 {
    "username":"APIuser",
    "token":"CTMNzj**********CP",
    "source":{
        "group_name": "Lingport",
        "project_name": "CET-WorldWindExplorer",
        "module_name": "lili"
     }
 }

Duplicate Command Center project

 curl "COMMAND_CENTER_URLapi/createFromTemplateProject" -d '{"username":"API_USER","token":"API_TOKEN","source": {"group_name": "source_group","project_name": "source_project","module_name": "source_module"},"target": {"group_name":"target_group","project_name": "target_project","module_name": "target_module"}}'  --header "Content-Type: application/json"


  • For Git projects:
    • The target group name is the name of the Git organization
    • The target project name is the name of the Git project in that organization
    • The target module name is the branch of the Git Project in the organization


Example: For a target repository name https://github.com/Lingoport/Command-Center, branch 'liliDev', with a template called Lingoport Command-Center dev in Command Center using https://github.com, the following call would be make:

 curl "http://localhost:8080/command-center/api/createFromTemplateProject" -d '{"username":"APIuser","token":"CTMNzj**********CP","source": {"group_name": "Lingoport","project_name": "Command-Center","module_name": "dev"},"target": {"group_name":"Lingoport","project_name": "Command-Center","module_name": "liliDev"}}'  --header "Content-Type: application/json"

or

 curl "COMMAND_CENTER_URLapi/createFromTemplateProject" -d @dupProject.json  --header "Content-Type: application/json"
 dupProject.json:
  {
    "username":"APIuser",
    "token":"CTMNzj**********CP",
    "source":{
        "group_name": "Lingport",
        "project_name": "Command-Center",
        "module_name": "dev"
     },
     "target": {
         "group_name":"Lingoport",
         "project_name": "Command-Center",
         "module_name": "liliDev"
      }
  }

The dupProject.json file can be used for all the commands. Only the required values will be used.

List Command Center users

The command below lists users by role. Roles are:

  • administrator
  • manager
  • developer
  • translator
  • api


 curl "COMMAND_CENTER_URL/api/getUserList" -d '{"role": "ROLE","username":"API_USER","token":"API_TOKEN"}'  --header "Content-Type: application/json" -o users.json

Example:

 curl "http://localhost:8080/command-center/api/getUserList" -d '{"role": "developer","username":"APIuser","token":"CTMNzj**********CP"}'  --header "Content-Type: application/json"

or

 curl "https://dockertest2.lingoport.io/command-center/api/getUserList" -d @listusers.json --header "Content-Type: application/json"
 listusers.json:
 {
  "role": "developer",
  "username":"APIuser",
  "token":"CTMNzj**********CP"
 }

Assign Users to a Team

The command below assign users to a team, via their IDs.

 curl "COMMAND_CENTER_URL/api/assignUsersToTeam" -d '{"team": "TEAM","username":"API_USER","token":"API_TOKEN","userList":"COMMA SEPARATED LIST OF IDs"}'  --header "Content-Type: application/json" -o users.json

Example:

 curl "http://localhost:8080/command-center/api/assignUsersToTeam" -d '{"team": "Dev","username":"APIuser","token":"CTMNzj**********CP", "userList":"4,5,7,19"}'  --header "Content-Type: application/json"

or

 curl "https://dockertest2.lingoport.io/command-center/api/assignUsersToTeam" -d @userAssignment.json --header "Content-Type: application/json"
 userAssignment.json:
 {
   "team":"Dev",
   "username":"APIuser",
   "token":"9VwxxxxxxxxP14",
   "userList": "4,16"
 }