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 11 Next »

Software Development Kits (SDKs) contain the necessary toolkits to create an application using the OS to call the local API. If an API consumer wants to create an application, they can generate a server stub or client side SDK for a supported language/framework and use it to write a software application to consume the subscribed APIs.

Generating client SDKs in the API Store

Tip: A valid API subscription must exist in order to use the SDK. SDK generation is allowed per API. 

By default, SDK generation is enabled for Java and Android. If those two languages are sufficient, move to step 3. To enable SDK generation for other languages, 

  1. Open the <APIM_Home>/repository/conf/api-mamanger.xml file and edit the <SupportedLanguages> property of the <SwaggerCodegen> element to include any of the supported languages/frameworks. An example is shown below,

        <SwaggerCodegen>
            <ClientGeneration>
                <GroupId>org.wso2</GroupId>
                <ArtifactId>org.wso2.client.</ArtifactId>
                <ModelPackage>org.wso2.client.model.</ModelPackage>
                <ApiPackage>org.wso2.client.api.</ApiPackage>
                <!-- Configure supported languages/Frameworks as comma separated values,
                 Supported Languages/Frameworks : android, java, scala, csharp, cpp, dart, flash, go, groovy, javascript, jmeter,
                 nodejs, perl, php, python, ruby, swift, clojure, aspNet5, asyncScala, spring, csharpDotNet2, haskell-->
                <SupportedLanguages>java,android,ruby,php</SupportedLanguages>
            </ClientGeneration>
        </SwaggerCodegen>


    In this example, the supported languages are defined as Java, Android, Ruby and PHP. 

  2. Once the above configuration is saved, start the API Manager server. 
  3. In the API Store, open the API and click the SDKs tab. Download options are available for each programming language specified earlier in the api-manager.xml file.
  4. Download the SDK for the preferred language and use it to write software applications to consume the API.

    Tip: As mentioned above, a valid subscription should exist for the API. The SDK cannot be used without a valid access token for the subscription.

Generating server stubs and client SDKs in the API Publisher

The API Publisher has an embedded swagger editor with the ability to generate server code and client SDKs then and there.  

Client SDK and Server Stub generation in API Publisher is only supported for Rest APIs.


  1. Open an existing API and choose to edit it. 
  2. Click Edit Source to open the embedded swagger editor.
  3. To generate and download a server stub, click Generate Server and select a server stub from the list.
  4. To generate and download a client SDK, click Generate Client and select a client from the list.

The generated server stubs and client SDKs are generated using Swagger Codegen

It is recommended to add the securityDefinitions in the swagger definition to be able to pass access tokens when invoking an API. Edit the source of the API from the API Publisher and add the code given below.

securityDefinitions:
  default:
    type: oauth2
    authorizationUrl: 'https://<GW-HOST>:<GW-PORT>/authorize'
    flow: implicit
    scopes: {}
security:
  - default: []
  • No labels