Log in to the API Store and select an API (e.g.,
PhoneVerification 1.0.0
.)thePhoneVerification
API.Subscribe to the API using the
Bronze
tier if you haven't done so already.
Choose to go to the My Subscriptions page and generate an access token. If you already have an access token for the application, you have to regenerate it after 1 hour.
Let's invoke this API.Go to the Click on the API, then go to its API Console tab and expand the GET method.
Give values to the parameters and click Try it out to invoke the API.
Note the response that appears in the API Console. As we used a valid phone number in this example, the response returns as valid.
- Within a minute after the first API invocation, make another attempt to invoke the API.
- Note that you get a throttling error saying that you exceeded your quota. This is because you subscribed to the API on the Bronze throttling tier and the Bronze tier only allows you to make one call to the API per minute.
In the REST client, select the DELETE method and
Let's try to invoke the API againusing an unavailable resource name. - The call gets blocked by
Go to the API
Gateway. It doesn't reach your backend services as you did not allow the DELETE method for the resource when creating the API.
- In the REST client, select the GET method again but this time, give the resource name as
CheckPhoneNumbers
instead ofCheckPhoneNumber
.
- Again, you get the same
's Overview page in the API Store and get the API's URL.
Install cURL or any other REST client.
Go to the command-line invoke the API using the following cURL command.
Code Block curl -k -H "Authorization :Bearer <access token in step 3>" '<API's URL in step 9>/CheckPhoneNum?PhoneNumber=18006785432&LicenseKey=0'
Note that the
PhoneVerification
API's resource name isCheckPhoneNumber
, but we use an undefined resource name asCheckPhoneNum
. Here's an example:Code Block curl -k -H "Authorization :Bearer 633d6db88e6ee42457e60ad1b736210" 'https://localhost:8243/phoneverify/1.0.0/CheckPhoneNum?PhoneNumber=18006785432&LicenseKey=0'
- Note that the call gets blocked by the API Gateway with a 'no matching resource' message that you got in step 9. This is because . It doesn't reach your backend services as you are trying to access a REST resource that is not defined for the API.
You have seen how the API Gateway enforces throttling and resource access policies for APIs.