REpresentational State Transfer (REST) is an architectural style for designing web services that access a system's resources using HTTP methods.
With the release of DataFlux Data Management 2.7 earlier this year, three new REST Application Programming Interfaces (APIs) are now available:
- Data Management Server Batch Jobs
- Data Management Server Real-time Data Jobs
- Data Management Server Real-time Process Jobs
The Base URLs for the new Data Management Server REST APIs are:
Batch Jobs – http://<DM Server IP address or server name>:<port>/ SASDataMgmtBatchJob/rest
Real-time Data Services – http://<DM Server IP address or server name>:<port>/ SASDataMgmtRTDataJob/rest
Real-time Process Services – http://<DM Server IP address or server name>:<port>/ SASDataMgmtRTProcessJob/rest
Here is a sample call to the Base URL for Real-time Data Services:
http://my_dmserver.com:21036/SASDataMgmtRTDataJob/rest
The Data Management Server job or service name is referred to by its ID which is simply the name of the job or service (with its extension) Base64 encoded. You can use this site to Base64 encode text. Base64 encoding is a common standard use to encode paths or other resource names in any URL. For example, without Base64 encoding, a filename and path that contains a space can cause problems.
Here is a sample call for a specific Real-time Data Service using its Base64 encoded name for its ID.
http://my_dmserver.com:21036/SASDataMgmtRTDataJob/rest/jobFlowDefns/ RGV0ZXJtaW5lX0dlbmRlci5kZGY=
Note that the returned text contains information about the links to call (href), method to use as well as content type of the request.
Before reviewing the REST API metadata information for the service, let’s first look at testing the Determine Gender data service using the Data Management Server test service utility.
The input of the service is Name and the output is Gender.
Here is an example of the REST API metadata information which includes the inputs and outputs for the Determine_Gender.ddf service.
http://my_dmserver.com:21036/SASDataMgmtRTDataJob/rest/jobFlowDefns/ RGV0ZXJtaW5lX0dlbmRlci5kZGY=/metadata
The following are some common tools for testing REST APIs requests and responses:
- Mozilla Firefox Add-On: https://addons.mozilla.org/en-US/firefox/addon/httprequester/
- Google Chrome Add-On: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
- SOAPUI: http://www.soapui.org/Downloads/latest-release.html
Here is an example of the request/response information for executing the Determine Gender data service. The input Names of “John Smith” and “Jane Smith” were sent to the service and the Genders of “M” and “F” were returned. (The Mozilla Firefox Add-on tool was used to generate this information.)
The table below lists the possible HTTP status response codes that could be returned by a Data Management Server REST API request:
For more information refer to the DataFlux Data Management Server 2.7: REST API Reference guide.
2 Comments
Dear Mary,
We are trying to send a POST request via REST API using the above method, but we are getting a connection timeout error. Can you please guide what are we missing? Is it some config parameters that needs to be set?
Your help would be very very helpful
A common mistake is not using the correct content-type. Refer to the DataFlux Data Management Server 2.7: REST API Reference guide for the appropriate type for your request.(http://support.sas.com/documentation/onlinedoc/dfdmserver/2.7/dmpdmsrvrestref/Default.htm)
Also, make sure you test your action using Data Management Server Manager to ensure the Data Management Server configuration is correct before working with jobs/services via REST APIs.