Working with Postman collections
Postman is a popular API test tool that lets you send HTTP requests to a server and review the responses. This tutorial shows you how to send REST API calls to the Web Services gateway using the Postman application.
Already familiar with Postman and Web Services? Skip the tutorial and download the REST API collection for Postman.
Prerequisites
- You must have an active Web Services developer license, which includes a Web Services sender ID and password. If you need a developer license, contact your account manager.
- The company to which you will be sending API requests must authorize your sender ID. You can either add your web sender ID to the Company Security tab or log in as an admin user when approving the OAuth authorization request.
- There must be an Intacct user with the permissions required by your application. It is strongly recommended that you use a Web Services user.
- You must obtain a client ID and client secret from the Sage App Registry. See the Quick start topic for details.
-
You must add
https://oauth.pstmn.io/v1/browser-callback
to the Redirect URIs field in the Sage App Registry. See the Quick start topic for details.
About Postman
Postman lets you create a workspace where you can add environment variables and store frequently used settings for your requests. You can then create a collection of commonly used requests that rely on these variables.
This tutorial will show you how to set up your Web Services credentials as variables. You will then import a collection of requests and run them.
To install Postman, download the Postman installer for your platform and run it.
Open the application and create an account, or sign in if you already have one.
If you plan on modifying any collection in Postman, make sure you log in first or you might lose your work. Also, If you change any of the calls in the collection, rename them if you don’t want them overwritten when re-importing the collection at a later time.
Download the Sage Intacct REST API collection
Download the Sage Intacct REST API collection for Postman, which includes:
-
Intacct.postman_collection.json
- a file which contains a set of API operations that you can run and modify. The collection is organized by application area, such as Accounts Payable, Accounts Receivable, Cash Management, and so forth. -
Intacct.postman_environment.json
an environment file that sets variables used by the operations.
Unzip the file to a folder on your local system.
Create your workspace
-
On the top left of Postman, click the
Workspaces
drop-down and select
Create Workspace
.
- Select Blank workspace and click Next . Give your new workspace a name and click Next .
-
Select the appropriate access permission for the workspace, then click
Create
.
- In the new workspace, click Import and select the folder where you unzipped the downloaded file.
-
Click
Environments
and then select the
Intact
environment. You should see the following variables. ReplaceclientId
andclientSecret
with the values you obtained from the Sage App Registry (see the Prerequisites section). Values are case-sensitive. - Save your changes.
- In the top right corner, select the Intacct environment.
Authorize your session
Your session must be authorized by an Intacct user in order to get an access token, which must then be included in every API request.
-
Click on
Collections
, then click on
Sage Intacct REST API
which is the top level of the collection. -
Select the
Authorization
tab. Verify that
Type
is set to
OAuth 2.0
, Add auth data to toRequest Headers
, and Header Prefix toBearer
. -
Scroll down and verify your token is configured as follows:
-
Token Name
: your desired name, for example
Intacct token
-
Grant type
:
Authorization Code
- Check the Authorize using browser box.
-
Auth URL
:
{{baseUrl}}/oauth2/authorize
-
Access Token URL
:
{{baseUrl}}/oauth2/token
-
Client ID
:
{{clientId}}
-
Client Secret
:
{{clientSecret}}
-
State
: a code of your choice, for example
1234
-
Client Authentication
:
Send as Basic Auth header
-
Token Name
: your desired name, for example
- Scroll to the bottom and click Get New Access Token . Postman will open the Sage Intacct log in screen in your browser.
-
On the Sage Intacct log in screen, provide your company credentials, then click
Log in
. Log in as an admin user to add your Web Services sender ID to the list of authorized web services for the company.
-
Click
Accept
to grant access.
-
Click
Use Token
to save the access token which can now be used to send requests to the REST API.
- In Postman, scroll up to the Current Token section and confirm that you can now see your new token.
Send a request
You are now ready to get some information about objects in your company.
-
Select
Accounts Payable > Vendors
, then
List vendors
from the collection.
-
Click the
</>
icon on the right to preview the code snippet for your request.
-
Click
Send
to post the request.
Assuming there are vendor objects in your company, you will see up to 100 vendor objects listed in the response.
You can now send other requests for any Accounts Payable objects, or get a token and send requests in other application area collections.