Jump to: navigation, search

Interpreting a response

On the previous page, we showed you how to use cURL to make some basic requests. Now we will show you how to interpret the response from the Web Services server.

Determining your Web Services version

The first request we sent asked for the current version of Web Services. It looked like this:

curl http://000.111.222.333/api/v2/diagnostics/version

The following response starts with a status code of 0, which indicates that our request was successful. The version parameter, surprisingly enough, tells you what your current version of Web Services is:

{"statusCode":0,"version":"8.5.200.50"}

Web Services status codes

When you are trying to figure out what happened with your request, you may find it helpful to understand the status codes that have been returned by the Web Services server. These codes are described in a table on the Return Values page.

Note in particular that a status code of 20 means that you have failed authentication, as we will show in the next section.

Getting user information

The second request we sent on the previous page asked for information about user ksippo. This request included authentication information, as shown here:

curl -u ksippo: http://000.111.222.333/api/v2/me

This request should receive a status code of 0, followed by user information about ksippo:

{
	"statusCode":0,
	"user":{
		"id":"63630bbebf4840d7a0bffd6312bc29ff",
		"userName":"ksippo",
		"firstName":"Kristi",
		"lastName":"Sippola",
		"roles":["ROLE_AGENT"],
		"enabled":true,
		"changePasswordOnFirstLogin":false,
		"uri":"http://127.0.0.1/cloud-web/api/v2/users/63630bbebf4840d7a0bffd6312bc29ff",
		"path":"/users/63630bbebf4840d7a0bffd6312bc29ff"
	}
}

Don't forget...

Note that if we send that request without including authentication information, we will receive an error message. That is, if we send something like this:

curl http://000.111.222.333/api/v2/me

...the Web Services server won't let us in, and will send a response like this:

{"statusCode":20,"statusMessage":"Access denied"}

As mentioned above, the status code of 20 indicates that we have failed authentication and are therefore denied access, as clarified by the status message.

[+] Click here to see other ways you can retrieve user information.

What's next?

Next up, let's learn how to work with agents.

This page was last edited on March 25, 2016, at 18:22.
Comments or questions about this documentation? Contact us for support!