PATHS - Web Services API v2.0

This is the public end-point of the PATHS Web Service API. Here you will find a simple introduction as well as code samples and documentation.

PATHS Prototype Application

PATHS Web Service API Reference Documentation

In order facilitate the efficient use of the system, an online API reference is available from the here. Here users can find documentation for all Web Services, Web Methods as well as their respective request and response formats.

List of Web Services

By default, these web services will return the response JSON wrapped in an XML element named "string". The encoding will be UTF-8. To get pure JSON, please make sure to pass the Content-Type parameter as part of the HTTP/POST request:

EXAMPLE: HTTP Header of POST Request

Content-Type: application/json; charset=utf-8

If you use a library like Jquery to parse the HTTP request, an additional paramter instructs the parser of the format of the return data type. Similar mechanisms may exist for other parsers.

EXAMPLE: jQuery.ajax request:

$.ajax({
type: "POST",
url: "/Usr.asmx/CreateUser",
data: "{
'cognitiveStyle':'1',
'usr':'myUser',
'pwd':'myPassword',
'email':'myEmail@myDomain.com',
'openid':'true'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: done,
error: cstatus
});

The JSON result of any web service request will be wrapped in an additional top-level object "d". Take this into account when parsing the response. This is supposedly a "security" feature of the .NET Framework. On the next level of the object, the value "code" states whether the request was successful and the object data is an array of values.

EXAMPLE: Response JSON from Web Service Request

{
"d
":{
"code": "2",
"data": [{"id":"1","fk_usr_id":"1","fk_rel_uri":"http://www.bergheim.dk","comment":"This is a third comment","isdeleted":"0","tstamp":"04/04/2012 23:56:21"}]
}
}

To return the value of "fk_rel_uri" in JavaScript, you would type
var uri = d.data[0].fk_rel_uri;

When a JSON result yields more than one return item, i.e. a result set from a query, items are accesible through a zero-based Array.

EXAMPLE: Response JSON from Web Service Request yielding more than one item

{
"d":{
"code": "2",
"data": [{"id":"3","fk_usr_id":"1","fk_rel_uri":"http://www.bergheim.dk","comment":"A comment","isdeleted":"0","tstamp":"04/04/2012 23:56:21"},
{"id":"2","fk_usr_id":"1","fk_rel_uri":"http://www.bergheim.dk","comment":"Another comment","isdeleted":"0","tstamp":"04/04/2012 23:56:21"},
{"id":"1","fk_usr_id":"1","fk_rel_uri":"http://www.bergheim.dk","comment":"A third comment","isdeleted":"0","tstamp":"04/04/2012 23:56:21"}]
}
}

To iterate through the results and retrieve the comments in JavaScript you would do something like this:
for (var i = 0; i < jsonData.d.data.length; i++) {
var title = d.data[i].comment;
}

Service status codes

The following return codes are used for PATHS web services and can be used to validate the results.

1: Authentication failed, wrong username or password.
2: Operation completed successfully
3: Operation failed!
4: Authentication succeeded, user logged in

Authentication

Most of the services require the user to be authenticated. Authentication is maintained between requests through a session cookie which is sent along with the HTTP-request from the Client application. A call to the web service "Authenticate" with the credentials as parameters will set session variables letting other web services know that the user is authenticated - as well as store the usr_id for use in user profile related functions.

http://development.paths-project.eu/Usr.asmx/Authenticate

The PATHS project is co-funded by the European Commission. PATHS Project 2013. Some rights reserved.