This documentation is for WSO2 API Manager 1.7.0 View documentation for the latest release.
Publisher APIs - API Manager 1.7.0 - WSO2 Documentation

All docs This doc
||
Skip to end of metadata
Go to start of metadata

Publisher APIs provide the following REST resources.

Note: When you access any API other than the login and logout APIs through an external REST client such as cURL, first invoke the login API to ensure that user is authenticated. When the login API is invoked, the system stores the generated session cookie in a file, which we use in the next API invocations.

Alternatively, if you access these APIs from the API Publisher application itself, you do not have to invoke the login API first.

Login

DescriptionLog in to API Publisher web application.
URI

http://localhost:9763/publisher/site/blocks/user/login/ajax/login .jag

URI Parametersaction=login&username=xxx&password=xxx
HTTP MethodsPOST
Example

curl -X POST -c cookies http://localhost:9763/publisher/site/blocks/user/login/ajax/login.jag -d 'action=login&username=admin&password=admin'

Logout

DescriptionLog out from API Publisher web application.
URIhttp://localhost:9763/publisher/site/blocks/user/login/ajax/login .jag
URI Parameters?action=logout
HTTP MethodsGET
Examplecurl -b cookies http://localhost:9763/publisher/site/blocks/user/login/ajax/login.jag?action=logout

Add/Update API

DescriptionAdd a new API or update an existing API.
URIhttp://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag
URI Parameters

Add API: "action=addAPI&name=xxx&visibility=public&version=x.x.x&description=xxx&endpointType=nonsecured&http_checked=http&https_checked=https&&wsdl=&tags=x,y,z&tier=Silver&thumbUrl=<File>&context=/xxx&tiersCollection=Gold&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*"  -d'endpoint_config={"production_endpoints":{"url":"<URL>","config":null},"endpoint_type":"http"}';

Update API
: "action=updateAPI&visibility=public& thumbUrl=<File> &description=xxx&tags=x,y,z& endpointType=nonsecured&http_checked=http&https_checked=https&
wsdl=&tier=Silver&thumbUrl=<URL>&tiersCollection=Gold&resourceCount=0&re sourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&u riTemplate-0=/*"  -d'endpoint_config={"production_endpoints":{"url":"<URL>","config":null},"endpoint_ type":"http"}';

Tip: If you want to set only the HTTP transport, leave the https_checked parameter empty as http_checked=http &https_checked=& .

Tip: To add a thumbnail image, create a file object of that thumbnail and pass it with the thumbUrl parameter. See sample in this getMultipartEntity() method.

Tip: API visibility is mandatory in the REST call due to a known issue, which is fixed in API Manager 1.9.0 onwards.

HTTP MethodsPOST
Example

Add API :
curl -X POST -b cookies http://10.100.1.71:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=YoutubeFeeds&visibility=public&version=1.0.0&description=Youtube Live Feeds&endpointType=nonsecured&http_checked=http&https_checked=https&&wsdl=&tags=youtube,gdata,multimedia&tier=Silver&thumbUrl=http://www.10bigideas.com.au/www/573/files/pf-thumbnail-youtube_logo.jpg&context=/youtube&tiersCollection=Gold&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*"  -d'endpoint_config={"production_endpoints":{"url":"http://gdata.youtube.com/feeds/api/standardfeeds","config":null},"endpoint_type":"http"}';

Update API :
curl -X POST -b cookies http://10.100.1.71:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action= updateAPI &visibility=public&description=Youtube Live Feeds&endpointType=nonsecured&http_checked=http&https_checked=https&&wsdl=&tags=youtube,gdata,multimedia&tier=Silver&thumbUrl=http://www.10bigideas.com.au/www/573/files/pf-thumbnail-youtube_logo.jpg&context=/youtube&tiersCollection=Gold&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*"  -d'endpoint_config={"production_endpoints":{"url":"http://gdata.youtube.com/feeds/api/standardfeeds","config":null},"endpoint_type":"http"}';

From APIM 1.6.0 onwards, this service accepts endpoint configuration data as a JSON value. In endpoint config JSON, you have to specify "endpoint_type" and "production_endpoints" and/or "sandbox_endpoints".

Add the argument subscriptions=all_tenants to enable subscription to this API by all tenants. To enable subscription to selected tenants, use subscriptions=specific_tennats&tenants=<tenant name>. For example,

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=YoutubeFeeds&visibility=public&version=1.0.0&description=Youtube Live Feeds&endpointType=nonsecured&http_checked=http&https_checked=https&&wsdl=&tags=youtube,gdata,multimedia&tier=Silver&thumbUrl=http://www.10bigideas.com.au/www/573/files/pf-thumbnail-youtube_logo.jpg&context=/youtube&tiersCollection=Gold&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*&subscriptions=all_tenants"  -d'endpoint_config={"production_endpoints":{"url":"http://gdata.youtube.com/feeds/api/standardfeeds","config":null},"endpoint_type":"http"}';

Get All APIs

DescriptionLists all the created APIs.
URI    http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag
URI Parameters?action=getAllAPIs
HTTP MethodsGET
Examplecurl -b cookies   http://localhost:9763/publisher/site/blocks/listing/ajax/item-list .jag ?action=getAllAPIs

Get an API

DescriptionGet details of a specific API.
URI    http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag
URI Parametersaction=getAPI&name=xxx&version=xxx&provider=xxx
HTTP MethodsPOST
Examplecurl -X POST -b cookies http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag -d "action=getAPI&name=API1&version=1.0.0&provider=user1"

Remove an API

DescriptionRemove an API.
URIhttp://localhost:9763/publisher/site/blocks/item-add/ajax/remove.jag
URI Parametersaction=removeAPI&name=xxx&version=xxx&provider=xxx
HTTP MethodsPOST
Examplecurl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/remove.jag -d "action=removeAPI&name=API1&version=1.0.0&provider=user1"

Copy an API

DescriptionCopy an API to a newer version.
URI http://localhost:9763/publisher/site/blocks/overview/ajax/overvi ew.jag
URI Parameters

action=createNewAPI&provider=xxx&apiName=xxx&version=xxx&newVersion=xxx

HTTP MethodsPOST
Examplecurl -X POST -b cookies http://localhost:9763/publisher/site/blocks/overview/ajax/overview.jag -d "action=createNewAPI&provider=user1&apiName=API1&version=1.0.0&newVersion=2.0.0&isDefaultVersion=default_version"

Check Older Version

DescriptionDoes older version of API exist.
URI  http://localhost:9763/publisher/site/blocks/life-cycles/ajax/life-cycles .jag
URI Parameters

?action=isAPIOlderVersionExist&provider=xxx&name=xxx&version=xxx

HTTP MethodsGET
Examplecurl -X POST -b cookies     http://localhost:9763/publisher/site/blocks/life-cycles/ajax/life-cycles .jag ?action=isAPIOlderVersion Exist&provider=user1&name=API1&version=1.0.0

Change API Status

DescriptionChange the API's status.
URI http://localhost:9763/publisher/site/blocks/life-cycles/ajax/life-cycles .jag
URI Parameters

action=updateStatus&name=xxx&version=1.0.0&provider=apiCreateName&status=PUBLISHED&publishToGateway=true&requireResubscription=true

HTTP MethodsPOST
Examplecurl -X POST -b cookies 'http://localhost:9763/publisher/site/blocks/life-cycles/ajax/life-cycles.jag' -d 'action=updateStatus&name=TwitterAPI&version=1.0.0&provider=provider&status=PUBLISHED&publishToGateway=true&requireResubscription=true'

Add/Update an API Document

DescriptionAdd a new API document.
URI  http://localhost:9763/publisher/site/blocks/documentation/ajax/docs.jag
URI Parameters

Add Document: action=addDocumentation&mode=Add&provider=xxx&apiName=xxx&version=xxx&docName=xxx&docType=xxx&sourceType=xxx&docUrl=xxx&summary=xxx&docLocation=xxx&docVisibility=owner_only/private 

Note that docVisibility is applicable only if you have enabled it. See API documentation visibility.

Update Document: action=addDocumentation&mode=Update&provider=xxx&apiName=xxx&version=xxx&docName=xxx&docType=xxx&sourceType=xxx&docUrl=xxx&summary=xxx&docLocation=xxx

HTTP MethodsPOST
Example

Add Document: curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/documentation/ajax/docs.jag -d "action=addDocumentation&provider=admin&apiName=api1&version=1.0.0&docName=test&docType=how to&sourceType=inline&docUrl=&summary=testing&docLocation="

Update Document: curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/documentation/ajax/docs.jag -d "action=addDocumentation&mode=Update&provider=admin&apiName=AP1&version=1.0.0&docName=test&docType=how to&sourceType=inline&docUrl=&summary=new summary&docLocation="

Remove an API Document

DescriptionRemove an API document.
URI   http://localhost:9763/publisher/site/blocks/documentation/ajax/docs.jag
URI Parameters

action=removeDocumentation&provider=xxx&apiName=xxx&version=xxx&docName=xxx&docType=xxx

HTTP MethodsPOST
Examplecurl -X POST -b cookies http://localhost:9763/publisher/site/blocks/documentation/ajax/docs.jag -d 'action=removeDocume ntation&provider=admin&apiName=API1&version=1.0.0&docName=doc1&docType=How To'
  • No labels