Link Search Menu Expand Document

APIs

  • On the left menu, open the APIs blade. You will see all APIs, the possibility to add new ones, but also to customize existing ones.

    APIM APIs

Add API from Scratch

Instead of developing an API, for this lab you will use the existing Star Wars API:

1) Click on Add API.
2) Click on HTTP - Manually define an HTTP API.
3) Select the Full option in the Create an HTTP API dialog.
4) Enter Display name Star Wars, Name star-wars, and, optionally, Description.
5) Assign https://swapi.dev/api to the Web service URL.
6) Keep the URL scheme at HTTPS as we strive to enforce HTTPS only.
7) Set the API URL suffix to sw. This allows us to compartmentalize the APIM URLs for distinct APIs.
8) Assign Starter and Unlimited products.
9) Press Create.

While it is conventionally a good idea to version APIs from the onset, we are omitting this step here for brevity of the labs.

APIM Add Blank API

  • Once created, inside the Star Wars API press + Add operation to declare two new operations:

    1) GetPeople

    • Display name: GetPeople
    • Name: getpeople
    • URL: GET /people/

    2) GetPeopleById

    • Display name: GetPeopleById
    • Name: getpeoplebyid
    • URL: GET /people/{id}/

    APIM Star Wars API Add Operation

Access Star Wars API from Developer Portal

  • Switch now to the Developer Portal and sign in as a developer with a subscription.
  • Select Explore APIs. You should see both Echo API and Star Wars.

    APIM Developer Portal Echo & Star Wars APIs

  • Click on Star Wars. Try the GetPeople operation. Observe a successful 200 response.

    APIM Developer Portal Star Wars Try It

  • Now try the GetPeopleById operation with id = 2

    APIM Developer Portal Star Wars Try It

  • Examine the successful 200 response with C-3PO’s details in the response body payload.

    APIM Developer Portal Star Wars Try It