com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

Publisher APIs

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.

The responses is a JSON message.

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 API

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

Given below are the parameters that you can pass with an Add-API call. Mandatory ones are marked with a *.

Parameter nameSyntax
Action*action=addAPI
Name*name=xxx
Context*context=/xxx
Version*version=x.x.x
API visibility*

visibility=<public|private|restricted>

This is mandatory in the REST call due to a known issue, which is fixed in API Manager 1.9.0 onwards. If you assign the value restricted , mention to which roles as follows: visibility=restricted&roles=role1,role2,role3.

You can read more about API visibility from here.

Thumbnail image

thumbUrl<URL>

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.

Descriptiondescription=xxx
Tagstags=x,y,z
Resources*

resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited

  • resourceMethod can take any one of the following values: GET, POST, DELETE, PUT, OPTIONS
  • resourceMethodAuthType can take any one of the following values: Application, Application User, Application and Application User, None
  • resourceMethodThrottlingTier can take any one of the following default values: Unlimited, Gold, Silver, Bronze. You can change the default values or have additional tiers defined in the /_system/governance/apimgt/applicationdata/tiers.xml registry location.
Endpoints*

This example adds an HTTP production endpoint: endpoint_config={"production_endpoints":{"url":"<URL>","config": {"format":"leave-as- is","optimize":"leave-as-is"," actionSelect":"fault"," actionDuration":60000} },"endpoint_type":"http"}

To give advanced endpoint configurations, add the JSON implementation inside "config:{}." If you don't have any advanced configurations, set it to null as "config":null.

You add sandbox endpoints in the same way. The only difference is that instead of production_endpoints, you give sandbox_endpoints.

If you want to add other types of endpoints like the Address and WSDL, follow the examples below:

  • For address endpoints:
    endpoint_config={"production_endpoints":{"url":"http://service.endpoint.com","config":null},"endpoint_type":"address"}
  • For WSDL endpoints:
    endpoint_config={"production_endpoints":{"url":"http://service.endpoint.com?WSDL","config":null},"wsdlendpointService":"EchoService", "wsdlendpointPort":"EchoServiceSoapPort","wsdlendpointServiceSandbox":"","wsdlendpointPortSandbox":"","endpoint_type":"wsdl"}
  • For failover endpoints:
    endpoint_config={"production_endpoints":{"url":"http://service.endpoint.com","config":null}, "production_failovers":{"url":"http://failover1.endpoint.com","config":null}, {"url":"http://failover2.endpoint.com","config":null}],"sandbox_failovers":[],"endpoint_type":"failover"}
  • For load balanced endpoints:
    endpoint_config" {"production_endpoints":[{"url":"http://service.endpoint1.com","config":null},{"url":"http://service.endpoint2.com","config":null}], "algoCombo":"org.apache.synapse.endpoints.algorithms.RoundRobin","failOver":"True", "algoClassName":"org.apache.synapse.endpoints.algorithms.RoundRobin", "sessionManagement":"simpleClientSession","sessionTimeOut":30,"endpoint_type":"load_balance"}
Endpoint security scheme

endpointType=<secured|nonsecured>

The default is non-secured but if you select 'secured', you must pass the credentials as follows: endpointType=secured&epUsername=<your username>& epPassword=<the password>

WSDL and WADLwsdl=xxx&wadl=xxx
Make default version

To mark this version of the API as the default version from a group of versions, give default_version_checked=default_version .

The Default Version option means that you make this version the default in a group of different versions of the API. A default API can be invoked without specifying the version number in the URL. For example, if you mark  http://host:port/youtube/2.0  as the default version when the API has 1.0 and 3.0 versions as well, requests made to http://host:port/youtube/ get automatically routed to version 2.0. 

If you mark any version of an API as the default, you get two API URLs in its Overview page in the API Store. One URL is with the version and the other is without. You can invoke a default version using both URLs.

If you mark an unpublished API as the default, the previous default, published API will still be used as the default until the new default API is published (or prototyped).

Tier Availability*tiersCollection=<Gold,Silver,Bronze,Unlimited>
Transports

http_checked=http&https_checked=https

Both are selected by default. If you want to set only the HTTP transport, leave the https_checked parameter empty as http_checked=http&https_checked=&.

Sequences

If you want to engage a custom sequence to the API, give inSequence=<sequence name>&outSequence=<sequence name> .
Please do not use the API Manager's management console to create sequences as the functionality is not supported. You can design all sequences using a tool like WSO2 Developer Studio, and store the sequence.xml file in the governance registry. For more information, see Creating ESB Artifacts in the Developer Studio documentation. 

Response caching

responseCache=<enabled|disabled>

 It is disabled by default but if you enable it, pass the response cache timeout as follows: responseCache=enabled& cacheTimeout=300

See Configuring Caching for more information.

Subscriptions

By default, subscription is allowed to the current tenant only.

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

See API visibility and subscription for more information.

Business information

Add a section like this: bizOwner=<name>&bizOwnerMail=<e-mail address>&techOwner=<name>&techOwnerMail=<e-mail address>

HTTP MethodsPOST
Example

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=addAPI&name=PhoneVerification&context=/phoneverify&version=1.0.0&visibility=public&thumbUrl=&description=Verify a phone number&tags=phone,mobile,multimedia&endpointType=nonsecured&wsdl=&wadl=&tiersCollection=Gold,Bronze&http_checked=http&https_checked=https&resourceCount=0&resourceMethod-0=GET&resourceMethodAuthType-0=Application&resourceMethodThrottlingTier-0=Unlimited&uriTemplate-0=/*&default_version_checked=default_version&bizOwner=xx&bizOwnerMail=xx@ee.com&techOwner=xx&techOwnerMail=ggg@ww.com" -d'endpoint_config={"production_endpoints":{"url":" http://ws.cdyne.com/phoneverify/phoneverify.asmx","config":null},"endpoint_type":"http "}';

Update API

DescriptionUpdate an existing API.
URIhttp://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag
URI Parameters

Update API: Parameters are same as in Add API except that action=updateAPI and you can only update the following parameters: visibility, t humbUrl, description, tags, endpointType, endpoint_config (can change the endpoint URL etc,) http_checked, https_checked, wsdl, wadl, tier, tiersCollection and can also add new resources. See example below.

HTTP MethodsPOST
Example

Update API : curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag -d "action=updateAPI&name=PhoneVerification&provider=admin&version=1.0.0&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,Silver&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"}';

Get All APIs

DescriptionLists all the created APIs.
URIhttp://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.
URIhttp://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag
URI Parametersaction=getAPI&name=xxx&version=xxx&provider=xxx
HTTP MethodsPOST
Example

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag -d "action=getAPI&name=PhoneVerification&version=1.0.0&provider=admin"

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
Example

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/remove.jag -d "action=removeAPI&name=PhoneVerification&version=1.0.0&provider=admin"

Copy an API

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

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

HTTP MethodsPOST
Example

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/overview/ajax/overview.jag -d "action=createNewAPI&provider=admin&apiName=PhoneVerification&version=1.0.0&newVersion=2.0.0&isDefaultVersion=default_version"

Check Older Version

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

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

HTTP MethodsPOST
Example

curl -X POST -b cookies http:publisher/site/blocks/life-cycles/ajax/life-cycles.jag?action=isAPIOlderVersionExist&provider=admin&name=PhoneVerification&version=1.0.0

Change API Status

DescriptionChange the API's status.
URIhttp://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
Example

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

Add/Update an API Document

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

Add Document: action=addDocumentation&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=PhoneVerification&version=1.0.0&docName=testDoc&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=PhoneVerification&version=1.0.0&docName=testDoc&docType=how to&sourceType=inline&docUrl=&summary=new summary&docLocation="

Remove an API Document

DescriptionRemove an API document.
URIhttp://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
Example

curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/documentation/ajax/docs.jag -d 'action=removeDocumentation&provider=admin&apiName=PhoneVerification&version=1.0.0&docName=testDoc&docType=How To'

Get all Throttling Tiers

DescriptionGet the throttling tiers that can be applied to APIs
URI

http://localhost:9763 /publisher/site/blocks/item-add/ajax/add.jag?

URI Parameters

action=getTiers

HTTP MethodsGET
Example

curl -b cookies http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag?action=getTiers

Check if API Exists

DescriptionCheck if an API by a given name exists in the API Publisher
URI

http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag

URI Parameters

action=isAPINameExist&apiName=<name of the API>

HTTP MethodsGET
Example

curl -b cookies "http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag?action=isAPINameExist&apiName=PhoneVerification"

Validate Roles

DescriptionVerifies whether the listed roles are valid in the tenant domain of the current user.
URI

http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag

URI Parameters

action=validateRoles&roles=<list of roles>

HTTP MethodsGET
Example

curl -b cookies "http://localhost:9763/publisher/site/blocks/item-add/ajax/add.jag?action=validateRoles&roles=admin"

com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.