Sending POSTs
You use a request tool, such as Postman, to ensure POSTs are well-formed and to review the structure of the response payloads. For more information, see Requests and responses.
Send a POST using Postman
Procedure
- In Postman, start a new request by clicking the + to the right of the Launchpad tab.
- Specify the appropriate authorization information.
- Under the Untitled Request label, make sure that POST is selected.
-
In the Enter request URL field, enter the URL for the server and
the endpoint.
- For example, to create a new note for activity pc:101 on an instance
of PolicyCenter on your machine, enter:
http://localhost:8180/pc/rest/common/v1/activities/pc:101/notes
- For example, to create a new note for activity pc:101 on an instance
of PolicyCenter on your machine, enter:
-
Specify the request payload.
- In the first row of tabs (the one that starts with Params), click Body.
- In the row of radio buttons, select raw.
- At the end of the row of radio buttons, change the drop-down list value from Text to JSON.
- Paste the request payload into the text field underneath the radio buttons.
- Click Send. The response payload appears below the request payload.
Tutorial: Create a new note that specifies required fields only
This tutorial assumes you have set up your environment with Postman and the correct sample data set. For more information, see Tutorial: Set up your Postman environment.
In this tutorial, you will create a note whose subject is "API tutorial note 1" for an existing activity. The other fields will not be specified and will be assigned default values by the application (such as not being confidential and having a subject of "General").
Tutorial steps
- In Postman, start a new request by clicking the + to the right of the
Launchpad tab.
- On the Authorization tab, select Basic Auth using user aapplegate and password gw.
- Alice Applegate has two "Review submission" activities. Enter the following
call and click Send to retrieve them:
GET
http://localhost:8180/pc/rest/common/v1/activities?filter=subject:eq:Review%20submission
- Identify the
id
of the first activity in the payload. This value is referenced below as <activityId>. - Open a second request tab and right-clicking the first tab and selecting Duplicate Tab.
- Change the operation to POST and enter the following URL, but do not click
Send yet:
POST
http://localhost:8180/pc/rest/common/v1/activities/<activityId>/notes
- Specify the request payload.
- In the first row of tabs (the one that starts with Params), click Body.
- In the row of radio buttons, select raw.
- At the end of the row of radio buttons, change the drop-down list value from Text to JSON.
- Paste the following into the text field underneath the radio buttons.
{ "data": { "attributes": { "body": "API tutorial note 1" } } }
- Click Send. The response payload appears below the request payload.
Checking your work
- View the new note in PolicyCenter.
- Log on to PolicyCenter as
aapplegate
and click My Activities. - Click the Subject header to sort the activities by subject.
- Find the first activity with the "Review submission", and click the subject. PolicyCenter opens an Activity Detail worksheet in the bottom pane.
- Click View Notes.
- Log on to PolicyCenter as
The API tutorial note is listed as one of the notes. If the note is not present, check the second "Review submission" activity.
Tutorial: Create a new note that specifies optional fields
This tutorial assumes you have set up your environment with Postman and the correct sample data set. For more information, see Tutorial: Set up your Postman environment.
In this tutorial, you will create a note whose subject is "API tutorial note 2" for an existing activity. You will also specify values for two optional fields: confidential (set to true) and topic (set to "Legal").
Tutorial steps
- In Postman, start a new request by clicking the + to the right of the
Launchpad tab.
- On the Authorization tab, select Basic Auth using user aapplegate and password gw.
- Alice Applegate has two "Review submission" activities. Enter the following
call and click Send to retrieve them:
GET
http://localhost:8180/pc/rest/common/v1/activities?filter=subject:eq:Review%20submission
- Identify the
id
of the first activity in the payload. This value is referenced below as <activityId>. - Open a second request tab and right-clicking the first tab and selecting Duplicate Tab.
- Change the operation to POST and enter the following URL, but do not click
Send yet:
POST
http://localhost:8180/pc/rest/common/v1/accounts/<accountId>/notes
- Specify the request payload.
- In the first row of tabs (the one that starts with Params), click Body.
- In the row of radio buttons, select raw.
- At the end of the row of radio buttons, change the drop-down list value from Text to JSON.
- Paste the following into the text field underneath the radio buttons.
{ "data": { "attributes": { "body": "API tutorial note 2", "confidential": true, "topic": { "code": "legal" } } } }
- Click Send. The response payload appears below the request payload.
Checking your work
- View the new note in PolicyCenter.
- Log on to PolicyCenter as
aapplegate
and click My Activities. - Click the Subject header to sort the activities by subject.
- Find the first activity with the "Review submission", and click the subject. PolicyCenter opens an Activity Detail worksheet in the bottom pane.
- Click View Notes.
- Log on to PolicyCenter as
The API tutorial note is listed as one of the notes. This note is confidential and it has the category specified in the request payload. If the note is not present, check the second "Review submission" activity.