Define an API request in Postman
After you create a collection in Postman, you will need to add your API endpoint by following the steps below.
- Select the collection name and select Add request.
- Add the request endpoint, and set the request to either
GET
orPOST
depending on the objective of the request. For example, to search for a user you can do the following:
- Method:
Post
- Endpoint:
https://[your OpenIAM instance]/webconsole/rest/api/users/search?deepCopy=true
- On the Headers tab, add the following header:
Key | Value |
---|---|
Content-Type | application/json |
- On the Body tab, select the raw radio button and add the search parameters as shown below:
{"from": 0,"size": 20,"lastName": null,"firstName": null,"principal": "sysadmin","email": "","roleIds": [],"groupIds": [],"organizationIds": [],"employeeId": "","fromDirectoryLookup": false,"sortBy": "name","orderBy": "ASC"}
The example above provides an example of how to search by user principal. Similarly, you can search for users with a last name that begins with "s" by using the following search parameters:
{"from": 0,"size": 20,"lastName": "s","firstName": null,"principal": "","email": "","roleIds": [],"groupIds": [],"organizationIds": [],"employeeId": "","fromDirectoryLookup": false,"sortBy": "name","orderBy": "ASC"}
Testing your request
After completing the steps listed above, you are ready to test your request.
- Go to your collection. From the Authorization tab get an access token by selecting Get new access token. Save the collection again.
- Go to your request and select Send. You will see a response similar to the example shown below.
{"error": null,"page": 0,"from": 0,"size": 1,"pageSize": 1,"beans": [{"id": "3000","beanType": "UserBean","operation": "NO_CHANGE","classification": null,"middleInit": null,"accessRightIds": null,"name": "sys user","phone": null,"email": null,"userStatus": "ACTIVE","accountStatus": null,"principal": "sysadmin","organization": "OpenIAM","department": null,"division": null,"title": "","employeeId": "","startDate": "","accessRightStartDate": null,"accessRightEndDate": null,"organizations": null,"location": null,"firstName": "sys","lastName": "user","nickname": null,"birthdate": null,"birthdateAsStr": null,"maidenName": null,"suffix": null,"sex": null,"gender": null,"jobCodeId": null,"prefix": null,"prefixLastName": null,"partnerName": null,"locationCd": null,"userTypeInd": null,"employeeTypeId": null,"employeeTypeName": null,"costCenter": null,"alternateContactId": null,"alternativeStartDate": null,"alternativeEndDate": null,"certificationDelegateId": null,"certificationDelegateEndDate": null,"certificationDelegateStartDate": null,"supervisorMdTypeName": "DEFAULT_USER","supervisorsNameList": null,"accountTypeName": null,"visible": false,"hasRelatedAccounts": false,"relationship": null,"mdTypeId": "DEFAULT_USER","applicationNames": null,"accessRightStartDateStr": null,"accessRightEndDateStr": null}],"emptySearchBean": false,"beansMap": null}