Using REST to Access a Third-Party Web Service

Problem

You want a job to access a third-party web service that uses a REST interface.

Solution

Create a job that uses a REST transformation to access the web service. Representational State Transfer (REST) is a set of architectural principles for designing web services that access a system's resources. A resource is accessed with a Uniform Resource Identifier (URI). The REST transformation generates SAS HTTP procedure code to read from and write to a web service in the context of a job.
To use the REST transformation, perform the following tasks:

Verify Prerequisites

It is assumed that you are familiar with how to use the REST interface to access web services. Gather the same information that you need to use the SAS HTTP procedure to read from and write to the desired web service. Example options and values are shown in the next section. For detailed information about the SAS HTTP procedure, see the documentation for that procedure in the Base SAS Procedures Guide.

Create a Job That Uses a REST Transformation to Access a Web Service

Perform the following steps. It is assumed that you are familiar with creating SAS Data Integration Studio jobs, as described in Creating Jobs.
  1. Create an empty SAS Data Integration Studio job.
  2. In the Transformations tree of the process editor, open the Access folder.
  3. Drag the REST transformation into the empty job.
  4. Right-click the REST transformation and select Properties.
  5. Specify the options that you need to read from and write to the desired web service. See the following table for some example values.
  6. Save the job.
  7. Run the job. Review status messages to verify that the job executed without error.
The following table shows an example set of options that you can specify in the REST transformation. In this example, when you submit a request to the web service, it returns contact information in the output variable RESTGetText_Auth_UserPwd.
Example Options for the REST Transformation
Tab Selection Path
Fields
Example Values
Optionsthen selectREST Properties
HTTP Method:
GET
HTTP request endpoint:
http://myComputer.com/contactservice/contactservice.svc/contacts
HTTP context-type:
application/x-www-form-urlencoded
HTTP charset:
windows-1252
Optionsthen selectInput and Output
Input type:
Text
Input text:
None
Output type:
Text
Output Text Macro Variable Name:
RESTGetText_Auth_UserPwd
Optionsthen selectAuthentication
Web authentication type:
Basic
Web authentication username:
myUserName
Web authentication password:
myPassword