Accessing the API for Endpoint Documentation and Testing

BarTender provides complete documentation for the API endpoints together with examples of actions in YAML, JSON, and BTXML formats. You can view this documentation after you install BarTender by using ReDoc, which is included in the BarTender installation file.

ClosedTo view the API by using ReDoc

  1. On the computer that has BarTender installed, open a browser window.

  2. In the browser address bar, enter the following URL:

    http://localhost:5159/api/actions/reference/

    In this URL, you can substitute "localhost" with the name or IP address of the computer that is running BarTender.

In ReDoc, you can expand the items in the left navigation pane and scroll to find the commands that you want. You can copy each command to your development environment and customize it as needed.

Before you design your own applications to work with the API, you might want to use a tool to test how the API can be used. You can use one of several popular tools, such as Insomnia and Postman, to access the API endpoints.

ClosedTo access the API endpoints by using Insomnia

The following sample procedure accesses the API by using Insomnia and tests a POST request for PrintBTWAction, which prints a BarTender document.

  1. In Insomnia, create a new POST request.

  2. Set the URL to the following:

    http://localhost:5159/api/actions?Wait=30s&MessageCount=200&MessageSeverity=Info

  3. On the Body tab, enter the following (make sure to preserve the indentation):

    PrintBTWAction:

    DocumentFile: <path to your BarTender document, such as D:\Temp\Sample.btw>

  4. On the Auth tab, select Microsoft NTLM, and then enter your credentials.

  5. Click Send.

Remote connection considerations

If you are running BarTender on a computer that is using a remote connection, consider the following guidelines when you access the REST API, both to run the API and to retrieve the API documentation

Troubleshooting

When you run the REST API, the following errors might occur: