Do we need an API?

The title says all.
I’ve spent some time to create an API for the WTS.
In fact for now it’s a only a very simple API with a few Endpoints

Here is what we have:

  • api/login
    to authenticate the user (we use JSON Web Tokens)
  • api/projects/me
    Endpoint that shows all projects of the user (owner as well as maintainer)

    Sample json response (shortened)

    {
       "data":[
          ...    
          {
             "project_id":4986,
             "name":"Video DownloadHelper",
             "slug":"3910-video-downloadhelper",
             "release_date":null,
             "created":{
                "date":"2016-01-29 22:28:06.000000",
                "timezone_type":3,
                "timezone":"UTC"
             },
             "updated":{
                "date":"2016-03-16 12:01:21.000000",
                "timezone_type":3,
                "timezone":"UTC"
             }
          }
          ...
       ]
    }
    
  • api/projects/{id}
    Endpoint that shows detailed info about a project, the maintainers, the locales with status, translators and so on.

    Sample json response (shortened)

    {
       "project":{
          "name":"Video DownloadHelper",
          "id":4986,
          "version":"5.5.0bz3",
          "created_at":"2016-01-29 22:28:06",
          "updated_at":"2016-03-16 12:01:21",
          "source_locale":{
             "name":"American English (United States)",
             "code":"en-US"
          },
          "num_of_files":1,
          "num_of_strings":538,
          "num_of_subs":0,
          "translated_in_percent":43.09,
          "maintainers":[
             {
                "name":"mig",
                "id":3910
             },
             {
                "name":"Fenian",
                "id":1
             }
          ],
          "locales":[
             {
                "name":"Arabic",
                "code":"ar",
                "open":0,
                "active":1,
                "status":"",
                "num_of_translated_strings":0,
                "num_of_translated_subs":0,
                "translated_in_percent":0,
                "translators":[
                   {
                      "name":"xx1429xx",
                      "id":13165,
                      "credits_to":""
                   },
                   {
                      "name":"GroupTT.com",
                      "id":15469,
                      "credits_to":"TT International Group (www.GroupTT.com)"
                   },
                   {
                      "name":"w.grouptt.com",
                      "id":15586,
                      "credits_to":""
                   },
                   {
                      "name":"ibraheem_alex",
                      "id":17989,
                      "credits_to":"Ibrahim Saed [ibraheem5000@gmail.com]"
                   }
                ],
                "created_at":"2016-01-29 22:28:06",
                "updated_at":"2016-03-16 12:01:21"
             },
             {
                "name":"Bulgarian",
                "code":"bg",
                "open":0,
                "active":1,
                "status":"",
                "num_of_translated_strings":524,
                "num_of_translated_subs":0,
                "translated_in_percent":97.4,
                "translators":[
                   {
                      "name":"Jeka",
                      "id":20111,
                      "credits_to":""
                   },
                   {
                      "name":"Kiril Yordanov Kirilov",
                      "id":20256,
                      "credits_to":""
                   }
                ],
                "created_at":"2016-01-29 22:28:06",
                "updated_at":"2016-03-16 12:01:21"
             },
             ... 
             {
                "name":"Chinese (Taiwan)",
                "code":"zh-TW",
                "open":0,
                "active":1,
                "status":"",
                "num_of_translated_strings":538,
                "num_of_translated_subs":0,
                "translated_in_percent":100,
                "translators":[
                   {
                      "name":"babeldown",
                      "id":15049,
                      "credits_to":"James (Silencer)"
                   },
                   {
                      "name":"2424724",
                      "id":20182,
                      "credits_to":""
                   },
                   {
                      "name":"FrankW",
                      "id":20199,
                      "credits_to":"Frank Wang"
                   }
                ],
                "created_at":"2016-01-29 22:28:06",
                "updated_at":"2016-03-16 12:01:21"
             }
          ]
       }
    }
    

What I’m thinking about:

  • Endpoints to update/create/delete/download files
  • Endpoints to list/get/create/delete/update strings
  • Endpoints to create/delete(?) translations

But I’m not an Add-On developer.
I don’t know what kinds of Endpoints are useful for an Add-On developers or not.
So this is also an appeal for help.
Let me know what you think and what you need.

Thanks

This entry was posted in Tech Room!, WTS (Web Translation System). Bookmark the permalink.