The RESTful interfaces have seen a significant expansion in this release.
Example usage of all the endpoints is given in the Postman Collection that can be downloaded by following the links in both the Dev Guide and the REST API reference.(http://help.sagecrm.com)
In this article, I want to explain how to download the new Postman Collection and be ready to use the endpoints for which it provides examples.
If you are new to Postman
Postman is a REST client than can be used to create and execute queries. You download the application here: https://www.getpostman.com/downloads/
It can also be used as a SOAP client which means that it can also be used with the Sage CRM SOAP web services.
As a client for the Sage CRM REST API it is very useful as it enables us to use all of the different types of transactions enabled by the API. This includes the ability to upload documents and files.
The Postman app has the feature of saving requests that are made to a particular endpoint. A Postman Collections is a set of these saved requests grouped in folders.
Downloading the Collection
The Help instructions within the API reference include how to import the collection files into Postman.
Once you have imported the collection it will look like this in Postman.
There is a recommended change to make in Postman.
This is because when using wildcard characters (%) in a GET request to return specific records, you may receive unexpected results.
For example, the following request that should return companies whose name contains Gate may actually return all companies:
GET http://SageCrmServer/sdata/crmj/sagecrm2/-/Company?where=comp_name like '%Gate%'
To change this behaviour and make wildcard characters work, go to Postman settings and disable the Use next-generation URL processing option.
Creating a Session ID
The endpoints exposed are designed to work with a Session ID. This token needs to be obtained by creating a session. That is done by using the SOAP web service.
You can see in the image below that when using the new endpoints a call to create a Session ID must first be made. If the Postman Collections provided by Sage have been imported then the environment used within Postman will pass the SID to each subsequent RESTful API call.