Configuration service

A REST API towards a Pointsharp ID configuration file. Please note that any encrypted password information will be considered as not set or empty by default. This means that passwords are not allowed to be read by this API. However, it is possible to retrieve the encrypted data by setting one of the HTTP request accept header parameters, if the encrypted data is still desired. See documentation about HTTP request headers for this REST API for further information.

Note that the configuration data is by default retrieved with the class type. See documentation about HTTP request headers for this REST API, for further information on how to disable the type information to be sent.

API Description

GET Configuration/SystemSettings/SelfService/DownloadUrl?Platform={Platform}&UsePin={UsePin}

Validates the request towards the User Portal settings and retrieves a download URL from the OATH token settings if the validation passed.

PUT Configuration/Core/Revision

Updates the current revision of a core service specified by the request.

GET Configuration/Core/Revisions

Retrieves the list of core services that have reported their current configuration revision to the web services.

GET Configuration/{path}

Gets the configuration specified by the request.

Examples

The configuration service enables retrieving the data stored in the Pointsharp ID configuration file. To retrieve a specific part of the configuration, we need to specify the path to the wanted configuration. The path represents the nodes in the tree structure of the full configuration. Please review the documentation for the syntax definition of a correct configuration path. Here follows a few examples of configuration paths.

Full configuration

View the full configuration.

Specific variable

The value of the UserDomainRemoval property in the Authentication method Pointsharp Password.

Path

Authentication/Methods/[Name=Pointsharp Password]/UserDomainRemoval

URL

http://localhost/Api/Configuration/Authentication/Methods/[Name=Pointsharp Password]/UserDomainRemoval

C#

Here follows example code of how to retrieve the full configuration from C# code.

C# configuration
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace PointSharp.WebServices.Examples
{
    class Program
    {
        static void Main(string[] args)
        {
            // Gets the whole Configuration file as Json string.
            var task = Get(@"http://localhost/api/Configuration");
            task.Wait();
            Console.WriteLine(task.Result);
            Console.ReadLine();
        }

        private static async Task Get(string url)
        {
            using (HttpClient client = new HttpClient())
            {
                return await client.GetStringAsync(url);
            }
        }
    }
}

HTML with JavaScript

Here follows example code of how to retrieve the full configuration from an HTML page using JavaScript. This example demonstrates how to disable the type data to be sent in the response by adding the IncludeType parameter to the accept header. This is made since less data is sent, and that the type data is not required for listing JSON data with JavaScript.

JavaScript configuration
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Configuration Sample</title>
</head>
<body>

	<h2>Configuration Sample</h2>
	<input type="button" value="Get Configuration" onclick="getConfig();" />

	<p id="msg" />

  <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.0.3.min.js"></script>
  <script>
	  var uri = "http://localhost/api/Configuration/";

	  function getConfig() {
		$.ajax({
			headers: {
				Accept: 'application/json; IncludeType=false'
			},
			url: uri,
			success: function (data, textStatus, jqXHR) {
				$('#msg').text(JSON.stringify(data));
			},
			error: function (jqXHR, textStatus, errorThrown) {
				$('#msg').text('Error: ' + errorThrown);
			}
		});
	  }
  </script>
</body>
</html>

GET Configuration/SystemSettings/SelfService/DownloadUrl?Platform={Platform}&UsePin={UsePin}

Validates the request towards the User Portal settings, and retrieves a download URL from the OATH token settings if the validation passed.

Request information

Parameters

Name Description Additional information

request

The request data specifying the mobile token to retrieve the download URL for.

Define this parameter in the request URI.

Parameter information

request

Contains data required to retrieve a download URL for a mobile token.

Property Description Additional information

Platform (String)

The platform of the mobile token to retrieve a URL for. Note that only non-personalized mobile token platforms will result in a valid response.

This parameter is required.

UsePin (Boolean)

The indicator whether to retrieve the URL for a PIN enabled mobile token or not.

This parameter is optional.

Response information

The download URL to the requested mobile token.

Response body formats

application/json, text/json
"http://ps.cloudapp.net/p"
application/xml, text/xml
<?xml version="1.0" encoding="utf-16"?>
<string>http://ps.cloudapp.net/p</string>

PUT Configuration/Core/Revision

Updates the current revision of a core service specified by the request.

Request information

Parameters

Name Description Additional information

request

The request data specifying the configuration revision of a core service to update.

Define this parameter in the request body.

Parameter information

request

Contains data specifying the current configuration revision used by a Pointsharp core service.

Property Description Additional information

Name (String)

The name of the service.

This parameter is required.

Revision (Int32)

The current configuration revision of the service.

This parameter is required.

Request body formats

application/json, text/json
{
  "Name": "sample string 1",
  "Revision": 2
}
application/xml, text/xml
<CoreRevisionRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>sample string 1</Name>
  <Revision>2</Revision>
</CoreRevisionRequest>

Response information

The current configuration revision of the web services

Response body formats

application/json, text/json
1
application/xml, text/xml
<int>1</int>

GET Configuration/Core/Revisions

Retrieves the list of core services that have reported their current configuration revision to the web services.

Response information

The list of reported configuration revisions.

Response body formats

application/json, text/json
{
  "sample string 1": 2,
  "sample string 3": 4
}

GET Configuration/{path}

Gets the configuration specified by the request.

Request information

Parameters

Name Description Additional information

request

The request data specifying the configuration to return. The request is defined in the URI by a path to the configuration to return. Each item in the path is separated with '/' e.g. ITEM/ITEM/ITEM.

None.

Parameter information

request

Contains data specifying a value or a set of values in a Pointsharp ID configuration file.

Property Description Additional information

Path (IEnumerable`1)

The path to the configuration value(s) to retrieve. A correct path contains no NULL values, and matches the XML tags in a Pointsharp ID configuration file. An empty path represents the path to the complete configuration. Each item in the path has the syntax TYPE for all nodes, while for any type of list also listens to the syntax: TYPE[PROPERTY=VALUE], TYPE[PROPERTY], or [PROPERTY] in order to filter which item(s) or item(s) value(s) to retrieve.

Example 1. Path to retrieve a specific configuration value

The following path represents the path to the value of UserDomainRemoval belonging to a specific authentication method in the configuration file: Authentication, Methods, [Name=Pointsharp Password], UserDomainRemoval

This parameter is required.

Response information

The configuration specified by the request.

Response body formats

application/json, text/json
true
application/xml, text/xml
<?xml version="1.0" encoding="utf-16"?>
<boolean>true</boolean>