This documentation is for WSO2 API Manager 1.5.0 View documentation for the latest release.
Page Comparison - Adding Documentation Using Swagger (v.17 vs v.18) - API Manager 1.5.0 - WSO2 Documentation

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Log in to the API Store Web interface (https://localhost:9443/store) and click the API published before.
  2. Subscribe to the API using the Bronze tier.
  3. Generate the access tokens. You need them to invoke the API in the next steps.
  4. Go Select the API again and go to the API Console tab, which shows the interactive documentation of the API. Using the API console, you can modify existing content, add/remove elements, change paths and parameters etc. using the JSON editor.

    Info

    By default, all the POST and PUT operations have the Payload parameter, which you can use to send any payload when invoking the API. The GET, DELETE operations have Query parameters, which you can use to send URL-appended values. You can also add named parameters. For example, to modify the path of the API created above with a parameter, edit the path and add the relevant parameter.

  5. Provide the necessary parameters and click Try it out to call the API. For example, the PhoneVerification API takes two parameters: the phone number and a license key, which is set to 0 for testing purposes.


    Note the following in the above UI:

    Base URLAppears at the bottom of the console. Using the base URL and the parameters, the system creates the API URL in the form http://host:8280/<context>/<version>/<back end service requirements included as parameters>. For example, http://host:8280/phoneverify/1.1.0/CheckPhoneNumber.
    Query ParametersGive the API payload as PhoneNumber=18006785432&LicenseKey=0 where /phoneverify is the context and 1.1.0 is the version. The rest of the URL is driven by the backend service requirements.
    AuthorizationIn the authorization header, pass the application key that was generated at the time a user subscribes to an API. This is prefixed by the string "Bearer". For example, Bearer q6- JeSXxZDDzBnccK3ZZGf5_AZTk.

    WSO2 API Manager enforces OAuth security on all the published APIs. Consumers who talk to the API Manager should send their credentials (application key) as per the OAuth bearer token profile. If you don't send an application key or send a wrong key, you will receive a 401 Unauthorized response in return.

     

  6. Note the response for the API invocation that appears as follows:
     
  7. Within a minute after the first API invocation, make another attempt to invoke the API and note that the second invocation results in a throttling error.

    This is because you
    applied a Bronze tier at the time you subscribed to the API and the Bronze tier only allows one API call per minute.

Updating the API definition

The API creator can update/customize the automatically generated API definition for each API.

  1. In the API Publisher, go to the Doc tab of FindFeeds API to see its API definition.
  2. API definition contains the JSON representation of the API. You can easily modify existing content, add/remove elements, change paths and parameters etc. using the JSON editor.

    Info

    By default, all the POST and PUT operations have the Payload parameter, which you can use to send any payload when invoking the API. The GET, DELETE operations have Query parameters, which you can use to send URL-appended parameters. You can also add named parameters.

    For example, to modify the path of the API created above with a parameter, edit the path and add the relevant parameter.

    To add new elements, click Add New Value and provide the value. To delete elements, delete the value of Key. For example, if you delete Key value description, that element will be deleted. The screenshot below shows path modified with a parameter.

    Image Removed

    The following screenshot shows parameter definition added for param and the default Payload parameter removed:

    Image Removed

    Also be sure to modify descriptions, notes, summary on each of the operations.

  3. Once the modifications are done, save and Publish the API.

  4. Log in to the API Store and click on GET operation to expand it. There you can enter the parameters and try it out.Image Removed

Next, see API Versioning.