Spectrum OnDemand provides a REST interface to web services. The interface supports the GET and POST methods. User-defined web services created in Spectrum 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 Spectrum Enterprise Designer.
To view the REST web services available on your Spectrum OnDemand server, go to:
http://server:port/rest
Service Endpoints
The endpoint for an XML response is:
http://server:port/rest/service_name/results.xml
https://OnDemandServer/rest/service_name/results.xml
The endpoint for a JSON response is:
http://server:port/rest/service_name/results.json
https://OnDemandServer/rest/service_name/results.json
Endpoints for user-defined web services can be modified in Spectrum Enterprise Designer to use a different URL.
For a list of Spectrum OnDemand servers, see Connecting to Spectrum OnDemand Servers.
WADL URL
The WADL for a Spectrum OnDemand web service is:
http://server:port/rest/service_name?_wadl
https://OnDemandServer/rest/service_name?_wadl
For a list of Spectrum OnDemand servers, see Connecting to Spectrum OnDemand Servers.
For example:
http://myserver:8080/rest/ValidateAddress?_wadl
https://spectrum.precisely.com/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.
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
https://spectrum.precisely.com/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.precisely.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
https://spectrum.precisely.com/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"
}
}
}