Unknown macro: {next_previous_links}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

The steps below explain how to modify an API's source code and delete an API.

Modifying an API

You can create an API using the API Publisher Web interface, and most common configurations are facilitated through the Web UI. But, if you want to do more advanced configurations to this API to customize it further, you have to go into its code-level configurations. You can do this using the steps given below.

  1. Log in to the Management Console UI (https://localhost:9443/carbon) using admin/admin credentials. Then, select Source View sub menu under the Service Bus menu.

  2. Source view contains the entire configuration of the API Gateway. You can find sequences, filters, properties, APIs etc. defined there. Search for the name of the API you want, and edit its content wrapped by the <api></api> elements.

    You should not remove the default filter mediator and handler configurations in your API. They are needed for routing requests based on the throttling/security policies. If you want to add a custom mediator in the insequence path of a request, add that inside the filter mediator configuration as shown in the following example.

    <filter source="$ctx:AM_KEY_TYPE" regex="PRODUCTION">
       <then>
          <class name="org.wso2.carbon.custommediator.CustomDataMediator"/>
          ........................
       </then>
    </filter>
  3. Click Update to save your changes.

  4. Alternatively, you can also select the APIs sub menu under the Service Bus menu. This allows you to isolate and edit a specific API rather than viewing the entire source code.

  5. The Deployed APIs page opens. From there, you can select an API and click the Edit link associated with it.
  6. The Edit API page opens. You can switch to its source view to edit its configuration code.

  7. After editing the file, save and restart the server.
Instead of editing the configuration through the UI, you can directly edit the file saved in <APIM_HOME>/repository/deployment/server/synapse-configs/default/api folder as well.

Deleting an API

Follow the instructions below to delete an API from the API Store through the API Publisher Web interface.

  1. Log in to WSO2 API Publisher (http://localhost:9763/publisher) Web application with credentials of a user who has the creator role assigned. For more information on creating users and assigning roles, refer to section User Management.
  2. The All APIs window opens.
  3. Click the Delete icon at the top right of a selected API to remove it, and confirm the deletion.

Once deleted, it will no longer be available in the API Store or the API Publisher.

  • No labels