Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Formatted

...

  1. Sign in to the API Store and select the PhoneVerification API.
    Make sure to subscribe to the API as mentioned in the before you begin section.

  2. Anchor
    AccessToken
    AccessToken
    Go to the Default Application, click the Production Keys tab 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. 

  3. Click on the API, then go to its API Console tab.

  4. Expand the GET method and click Try it out. Provide the required parameters and click  Execute to invoke the API. For example,

    PhoneNumberE.g., 18006785432
    LicenseKeyGive 0 for testing purpose

    Note the response that appears in the API Console. As we used a valid phone number in this example, the response returns as valid.

    Note that you subscribed to the API on the Bronze throttling tier. The Bronze tier allows you to make a 1000 calls to the API per minute. If you exceed your quota, you get a throttling error as shown below.
    Image Removed Image Added
    Let's try to invoke the API using an unavailable resource name.

  5. Go to the API's Overview page in the API Store and get the API's URL.

  6. Install cURL or any other REST client.

  7. Go to the command-line invoke the API using the following cURL command. 

    Localtabgroup
    Localtab
    activetrue
    idFormat
    titleFormat
    Code Block
    curl -k -H "Authorization :Bearer <access-token-in-step-3>" '<API's URL in step 5>/<API's-resource-name>?<parameter1>=<parameter1-value>&<parameter2>=<parameter2-value>'
    Localtab
    idCommand
    titleCommand

    Note that the PhoneVerification API's resource name is  CheckPhoneNumber , but we use an undefined resource name as  CheckPhoneNum . Here's an example:

    Code Block
    curl -k -H "Authorization :Bearer 63cc9779d6557f4346a9a28b5cfd8b53" '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. It doesn't reach your backend services as you are trying to access a REST resource that is not defined for the API.

    Code Block
    curl -k -H "Authorization :Bearer 344fd2a7-ee69-311a-9711-0437b0021415" 'https://localhost:8243/phoneverify/1.0.0/CheckPhoneNum?PhoneNumber=18006785432&LicenseKey=0'
    <am:fault xmlns:am="http://wso2.org/apimanager"><am:code>404</am:code><am:type>Status report</am:type><am:message>Runtime Error</am:message><am:description>No matching resource found for given API Request</am:description></am:fault>

...