How To
ForgeRock Identity Platform
ForgeRock Identity Cloud

How do I understand the underlying REST call being used in web requests in Identity Cloud or AM (All versions)?

Last updated Mar 31, 2021

The purpose of this article is to provide information on finding out what is included in REST calls being made in Identity Cloud or AM. This technique can be useful to help you formulate REST calls based on an existing web request or to troubleshoot why a REST call is not working as expected.


Overview

You can use the Developer Tools in your browser to copy a web request as a curl command and replay it on the command line. The resulting curl command includes all the headers, options, and data that was sent for the particular web request you are interested in. You can then use the information and REST syntax as the basis of your own REST calls or for comparison analysis when a request or endpoint is failing. 

See How do I avoid common issues with REST calls in AM (All versions)? for other troubleshooting tips.

Copying to curl

You can copy a web request to curl as follows:

  1. Launch the Developer Tools in your browser and select the Network tab.
  2. Enter the URL that you want to examine web requests for and let it load fully.
  3. Right-click on the required web request on the Network tab , select Copy followed by Copy as cURL.
  4. Paste the resulting curl command into a text file or onto the command line as needed.

These instructions apply to Chrome™, Firefox® and Microsoft® Edge.

Example

Copying the web request for creating a basic authentication tree produces the following curl command:

curl 'http://host1.example.com:8080/openam/json/realms/root/realm-config/authentication/authenticationtrees/trees/sampleTree' \   -X 'PUT' \   -H 'Connection: keep-alive' \   -H 'Pragma: no-cache' \   -H 'Cache-Control: no-cache' \   -H 'accept-api-version: protocol=2.1,resource=1.0' \   -H 'accept: application/json' \   -H 'if-none-match: *' \   -H 'x-requested-with: ForgeRock CREST.js' \   -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.80 Safari/537.36' \   -H 'content-type: application/json' \   -H 'Origin: http://host1.example.com:8080' \   -H 'Referer: http://host1.example.com:8080/openam/ui-admin/' \   -H 'Accept-Language: en-GB,en;q=0.9' \   -H 'Cookie: amlbcookie=01; iPlanetDirectoryPro=ji_S58bZ7iuOeRgdbny74vqJK5Y.*AAJTSQACMDEAAlNLABx5S3h5SHd3Y29HT1BRZGpoaVlkQS9VbERJc2M9AAR0eXBlAANDVFMAAlMxAAA.*' \   --data-binary '{"entryNodeId":"e301438c-0bd0-429c-ab0c-66126501069a","nodes":{},"staticNodes":{}}' \   --compressed \   --insecure

See Also

How do I avoid common issues with REST calls in AM (All versions)?

Getting Started with REST › REST API Explorer

Related Training

N/A

Related Issue Tracker IDs

N/A



Copyright and TrademarksCopyright © 2021 ForgeRock, all rights reserved.
Loading...