Twproject API documentation

Introduction

Welcome to Twproject API developers guide.

Here you will find how to get your API key, how to authenticate, and how to use our API requests.

Authentication

Twproject API authentication is based on an API key that can be generated by every Twproject enabled user.

The API will operate with this user privileges.

In order to generate a key go to user's security/login page


Then click on "generate key" button


The API key is mandatory when you call the API with a state-less client.

In case you are using the API from portlet/widget running inside Twproject itself (e.g: a customization) you can skip the key parameter, the current http session will be used for authenticating your requests.

API request and response

The API call is a HTTP JSON POST call.

You can call it using several client like CURL:

curl -k -L -H 'Accept: application/json' -H 'Content-Type: application/json' -d
'{"command":"get","object":"task","id":5,"full":true,"APIKey":"1-2529Mzg7p3g13651yFgv56619Ms469g7"}'
https://[your_server_url]/API/V1/?

or just a snip of javascript code.

var request = {
  APIKey:""1-2529Mzg7p3g13651yFgv56619Ms469g7",
  command:"get",
  object:"task",
  id:5,
  full:true
}
$.ajax({
  url:      https://[your_server_url]/API/V1/?",
  method:   "POST",
  dataType: "json",
  data:     JSON.stringify(request),
  success:  function (response) {
    //... here your code
  }
})

Every call will return a JSON object with the following structure. Additional parameters will be described in the relative request sections.

Attribute Type Always Sample Notes
ok boolean * false true/false
errors errorType [{name: "code",label: "Code",error: "Already existing value"}]. This error is generated in case of invalid attributes.
messagesFromController messagesFromControllerType [{type: "ERROR",title: "Something went wrong",message: "Invalid command......"}]
or
[{type: "OK",message: "Object correctly created"}]
These messagee are generated as additional feedback from the controller.
Could be OK, INFO, WARNING, or ERROR
Messages are generated in the user's language.
"object"
"objects"
{...}
[...]
{id:1,name:"xyz",...}
[{id:1,name:"xyz",...},{id:2,name:"abc",...},...]
See detail in the following sections relative to every command and object

API testing tool

In order to test the API and to have a closer look to the respons on your real data you can use the API Test page.

YOU WILL USE YOUR REAL DATA, BE CAREFUL!

You will find the palyground at the following url: https://[your_server_url]/API/APITest.jsp

It will looks like:


Using the API Test page without the API Key parameter, you will use it in session authenticated mode (stateful);
the current logged user will be used for every API call.

If you fill the API Key field, the system will use the corresponding user profile to perform the API calls

The API parameter