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

Create a Prototyped API with an Inline Script

In this tutorial, you create a prototyped API with an inline script, deploy it as a prototype, and invoke it using the API Console integrated in the API Store. Typically, you create APIs with inline scripts for testing purposes. An API prototype is created for the purpose of early promotion and testing. You can deploy a new API or a new version of an existing API as a prototype. It gives subscribers an early implementation of the API that they can try out without a subscription or monetization, and provide feedback to improve. After a period of time, publishers can make changes that the users request and publish the API. 

  1. Sign in to the API Publisher using admin as the username and password.
    https://<hostname>:9443/publisher (e.g., https://localhost:9443/publisher).
  2. Select the option to design a new REST API and click Start Creating.
  3. Give the information in the table below. To add resources, click the Add button. Since the URL Pattern used here is a variable, it is denoted within curly braces.

    Field
    Sample value
    Name
    Location_API
    Context
    /location
    Version
    1.0.0
    ResourcesURL pattern{town}

    Request types

    GET

  4. After the resource is added, expand its GET method and note that a parameter by the name town is added under the resource. You use it to pass the payload to the backend. Once done, click Next: Implement >. 

    To specify multiple parameters in the API resource, separate the parameters with a forward slash.

    {param1}/{param2}

  5. In the Prototyped API section under the Implement tab, select the implementation method as Inline.

    The inline JavaScript engine does not provide support for SOAP APIs. If you opt for the endpoint implementation method instead of inline, you need to provide an endpoint to a prototype API. For example, http://ws.cdyne.com/phoneverify/phoneverify.asmx

  6. Expand the GET method and give the following as the script. It reads the payload that the user sends with the API request and returns it as a JSON value. The value mc is the message context.

    mc.setProperty('CONTENT_TYPE', 'application/json');
    var town = mc.getProperty('uri.var.town');
    mc.setPayloadJSON('{ "Town" : "'+town+'"}');

  7. Click Deploy as a Prototype.

  8. When prompted, choose to open the newly published API in the API Store.

    Tip: You can invoke prototyped APIs without signing in to the API Store or subscribing to the API. The purpose of a prototype is advertising and giving an early implementation for users to test.

  9. The Location API opens. Click the API Console tab.

  10. Expand the GET method, click Try it out. Give any value for the town (e.g. London) and click Execute to invoke the API.
  11. Note the payload you gave as a JSON output in the response.

You have created an API with inline script, deployed it as a prototype and invoked it through the integrated API Console.

An API can also be prototyped by moving the API to the prototyped state in the API lifecycle. For more information, see the Deploy and Test as a Prototype tutorial.

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