The REST Interface

Spectrum™ Technology Platform provides a REST interface to web services. User-defined web services, which are those created in Enterprise Designer, support GET and POST methods. Default services installed as part of a module only support GET. If you want to access one of these services using POST you must create a user-defined service in Enterprise Designer.

To view the REST web services available on your Spectrum™ Technology Platform server, go to:

http://server:port/rest

Note: We recommend that you limit parameters to 2,048 characters due to URL length limits.

Service Endpoints

The endpoint for an XML response is:

http://server:port/rest/service_name/results.xml

The endpoint for a JSON response is:

http://server:port/rest/service_name/results.json

Endpoints for user-defined web services can be modified in Enterprise Designer to use a different URL.

Note: By default Spectrum™ Technology Platform uses port 8080 for HTTP communication. Your administrator may have configured a different port.

WADL URL

The WADL for a Spectrum™ Technology Platform web service is:

http://server:port/rest/service_name?_wadl

For example:

http://myserver:8080/rest/ValidateAddress?_wadl

User Fields

You can pass extra fields through the web service even if the web service does not use the fields. These fields are returned, unmodified, in the user_fields section of the response. For GET requests, user fields are passed in as a parameter in the URL like any other field. For POST requests, user fields are passed in as part of the user_fields element in the XML or JSON request.

Note: User field names may not contain characters that are invalid in XML or JSON element names. For example, spaces are not valid.

Sample REST Request Using GET with XML Response

The following example illustrates how to make a REST request to the ValidateAddress service using the GET method requesting a response in XML.

http://myserver:8080/rest/ValidateAddress/results.xml?Option.OutputCasing=U&​Data.AddressLine1=1825+Kramer+Lane&Data.PostalCode=78759

The sample request would result in this response since an XML response was requested:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xml.ValidateAddressResponse xmlns="http://www.pb.com/spectrum/services/ValidateAddress">
    <output_port>
        <Address>
            <Confidence>82</Confidence>
            <RecordType>Normal</RecordType>
            <CountryLevel>A</CountryLevel>
            <ProcessedBy>USA</ProcessedBy>
            <MatchScore>0</MatchScore>
            <AddressLine1>1825 KRAMER LN</AddressLine1>
            <City>AUSTIN</City>
            <StateProvince>TX</StateProvince>
            <PostalCode>78758-4260</PostalCode>
            <PostalCode.Base>78758</PostalCode.Base>
            <PostalCode.AddOn>4260</PostalCode.AddOn>
            <Country>UNITED STATES OF AMERICA</Country>
            <user_fields/>
        </Address>
    </output_port>
</xml.ValidateAddressResponse>

Sample REST Request Using GET with JSON Response

The following example illustrates how to make a REST request to the ValidateAddress service using the GET method requesting a response in JSON.

http://myserver:8080/rest/ValidateAddress/results.json?Option.OutputCasing=U&​Data.AddressLine1=1825+Kramer+Lane&Data.PostalCode=78759

The sample request wold result in this response since a JSON response was requested:

{
	"ns1.json.ValidateAddressResponse" :
	{
	"ns1.output_port" :
	{
	"ns1.Confidence" : 82,
	"ns1.RecordType" : "Normal",
	"ns1.CountryLevel" : "A",
	"ns1.ProcessedBy" : "USA",
	"ns1.MatchScore" : 0,
	"ns1.AddressLine1" : "1825 KRAMER LN",
	"ns1.City" : "AUSTIN",
	"ns1.StateProvince" : "TX",
	"ns1.PostalCode" : "78758-4260",
	"ns1.PostalCode.Base" : 78758,
	"ns1.PostalCode.AddOn" : 4260,
	"ns1.Country" : "UNITED STATES OF AMERICA"
	}
	}
}