Web service interface

You can call any Metrici service remotely through the web service interface.

There are two forms of the web service interface, one in which parameters are passed in the URL (or as POST parameters), and one in which the entire XML request is passed in the http request body.

URL-based web service call

The URL-based web services are available using URL /service/ServiceName. For example, the GetNode service is available at https://www.metrici.com/service/GetNode.

Parameters for the service call are passed using the same "flat XML" conventions as the Service Message Writer. In most cases, you only need to pass top-level XML elements which equate directly to URL parameters.

For example, the following returns details of the system.NODE_NAME node:

https://www.metrici.com/service/GetNode?nodeVersionReference=system.NODE_NAME

Parameters can be passed in the URL or as POST parameters using form data or multipart/form data conventions. Coming in 4.17: If the POST body if of a different type, the entire body will be available in the body parameter.

XML body web service call

For more complicated service calls, use URL /service and pass the entire XML request in the body of a POST request.

For example, on Linux you can use the curl utility, as in this example which runs the request in service.xml.

curl -X POST -H "Content-Type:application/xml" -L https://www.metrici.com/service -d "@service.xml"

You must set content type to be application/XML, and must set the -L option to follow redirects. The quotes around the @file specification are required when calling curl in Windows.

Web service credentials

If you call a Metrici web service from a browser and the browser session has already signed in to Metrici, then your credentials will automatically be added to each web service call.

In other cases, you need to pass credentials with each call, with a userLogonReference/password pair or a session token.

If you are passing XML in the body of a web service call, you must pass the credentials in the body.

If you are using a URL-based web service call, or passing parameters using formdata or multipart-formdata then either you can pass the credentials as parameter or can pass them using preemptive basic authentication. In preemptive basic authentication, a hash of the user name and password is sent in the Authorization header. You can use either:

  • A user name of the userLogonReference and password of the password.
  • A user name of "session" and a password of sessionToken:clientSessionToken. If you have a single-use session token, clientSessionToken is optional, but the session token will only work for a single call.

If you have not signed in to Metrici, and you are on a browser or some other web client that will use session cookies, you can mimic the sign in and sign out processes using the /service/SignOn web service, which takes user credentials, and the /service/SignOff web service. These will create a server-side session and apply credentials to all subsequent calls.

When you are passing credentials in web service calls, make sure to use https:// not http://. From a browser script on a Metrici page, you can use the global variable rootPath to find the correct URL (e.g. use rootPath + "service" for https://www.metrici.com/service).