API Requests - Getting Started

๐Ÿ“˜

Using the Requests client without an API Project

To create a request, you must have an API Project. If you do not have an API Project, you can create a simple one named My API Requests (or similar) to act as your web-based API client for playing with API Requests.

If your API Project was created by uploading an API spec file, you will see a list of requests from that spec in the Requests area. If you did not upload an API spec file, the Requests area will be empty.

Create a simple GET request

  1. Navigate to [YOUR HUB URL]/studio or click the My APIs link in the header of the API Hub. You may need to log in before accessing it.

  2. In the dropdown in the upper right, select Personal. This will display the API Projects in your Personal Account.

  3. Click on the API Project that you would like to use for sending requests. If needed, you can create one by clicking Add API Project in the upper right.

  1. In the center frame, next to Requests, click the + (Add Request).
  1. Click the new Request 1 request.

  2. In the HTTP method dropdown, select GET (it should already be selected).

  3. In the URL box to the right of the HTTP method dropdown, enter https://echo.paw.cloud. This is a simple service that responds with information about the request.

  4. Click Send. On the right, you should see a 200 OK response as well and information about the request.

  1. Click the Description tab in the center frame and rename the request GET Echo.

Create a POST request

  1. Click the vertical three dot menu next to your GET echo request (created above) and select Duplicate.

  2. Click the GET Echo Copy request.

  3. Change the HTTP method to POST.

  4. In the Description tab, change the request's name to POST Echo.

  5. Click the Headers tab and add header with a name of My-Test-Header and a value of Testing!.

  1. Click the Query parameter tab and enter a query parameter with a name of testQueryParameter and a value of myQueryValue. This will append ?testQueryParameter-myQueryValue to the request URL.

  2. Click the Body tab. Click JSON. Enter the following request body:

{"my-body-key": "my-body-value"}
  1. Click the Auth tab. Click Basic. Enter a Username of demo and a Password of sample.

  2. Click Send to send the request. Verify the following in the Response:

  • You receive a 200 OK response.
  • Your POST request URL has your testQueryParameter appended to it.
  • Your My-Test-Header was sent.
  • An Authorization header with an encoded value was sent. The API client Base64 encoded your Username and Password for you.
  • Your JSON body was sent with the request.
  1. In the Preview window in the bottom center, select the Node.js / Axios library from the dropdown (or your favorite option) and notice that the sample code is configured for you, including your query parameter, request headers and request body.