Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Public Application Programming Interface (API) function is an interface that allows sharing your datasets and widgets with your clients. In the Public API section of the MSPbots app, you can create, share, and delete your own API key. Once you have made and shared your public API, your clients can access the datasets and widgets assigned to that key.

What's on this page: 

Table of Contents

How to access the Public API section

...

To access the Public API section, log in to MSPbots and navigate to Settings Public API

Public APIImage Modified

How to add, copy, and remove an API key

...

  1. Create an API key: 

    1. Go to the Public API tab and click the Add New Key button. 

    2. Input a Name, select Custom for Type, and provide a short Description for your API.

      add new keyImage Modified 

    3. Click Save.
       

  2. Copy the API Key

    1. Select the API you created in Step 1 from the APIKey dropdown. 
      select APIImage Modified

    2. Click the copy icon to copy the API. Send this to your clients for access to your datasets and widgets. 
      copy api keyImage Modified

To remove an API Key, click the Remove This Key button. Removing an API key will draw your client's access to the datasets and widgets you assigned to the key. 

remove keyImage Modified

Connecting your data to an API

...

Binding a dataset to the API key

  1. Go to the Public API tab, click Datasets, and hit the Add button. 
    add datasetImage Modified
  2. On the Add Dataset window, select the dataset or datasets that should be accessible with the API key.
     select datasetImage Modified
  3. When done selecting the datasets for binding, click the Selected button to view your selection. You may remove datasets from the list by clicking the X sign corresponding to the dataset for removal. 
    add select datasetImage Modified
  4. Click Add Selected once you confirm the list is correct. 

Binding a widget to the API key

  1. Go to the Public API tab, click Widget, and hit the Add button. 
    add widgetImage Modified
  2. On the Add Widget window, select the widget or widgets that should be accessible with the API key.
     select widgetsImage Modified
  3. When done selecting the widgets for binding, click the Selected button to view your selection. You may remove widgets from the list by clicking the X sign corresponding to the widget for removal. 
    add select widgetImage Modified
  4. Click Add Selected once you confirm the list is correct. 

Stop connecting your data to the API

...

Unbinding your data 

To disconnect and unbind data to the API, click the Delete icon for the datasets and widgets.

Image Modified

Click Confirm to finish the deletion.
confirm deletionImage Modified

Enable Public API Switch 

...

The Enable Public API switch is the global switch that controls the availability of the Public API feature. The API Keys and all connected data will not be available if this switch is OFF or disabled. 

enable public apiImage Modified

Summary

...

  • Public API provides an HTTP-based API that follows the principles of REST.
  • The HTTP rules allow the use of simple HTTP clients like cURL.
  • The URLs are resource-oriented, the request format is form-encoded, and the responses are JSON.
  • All operations are read-only.

Resources

...

Public API follows the REST model of exposing resources as URLs. The unified domain name of all interfaces is:

https://api.mspbots.ai/ 

Request, Response, Sample Request

...

REQUEST

Depending on the type of operation, the endpoints use one of two HTTP methods: POST, GET


RESPONSE

The response is in JSON format.


SAMPLE REQUEST

GET REQUEST (Dataset)

curl https://api.mspbots.ai/api/dataset/{resourceId} -H 'apikey: {apiKey}' -X GET

REQUEST

Image Modified

RESPONSE

Image Modified

POST REQUEST (Widget)

curl https://api.mspbots.ai/api/widget/{resourceId} -H 'apikey: {apiKey}' -X GET

REQUEST

Image Modified

RESPONSE

Image Modified

Sample Error Response

  1. Rate limits
    Image Modified
  2. Invalid apiKey: Error or deleted
    Image Modified
  3. Resource unbound
    Image Modified

...

  1. The resource does not exist
    Image Modified