Versions Compared

Key

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

...

What's on this page: 

Table of Contents
stylenone

How to access the Public API section

...

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

Public API

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 key 

    3. Click Save.
       

  2. Copy the API Key

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

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

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 key

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 dataset
  2. On the Add Dataset window, select the dataset or datasets that should be accessible with the API key.
     select dataset
  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 dataset
  4. Click Add Selected once you confirm the list is correct. 
  5. Then you can see the selected dataset in the dataset list.

Image Added

Binding a widget to the API key

  1. Go to the Public API tab, click Widget, and hit the Add button. 
    add widget
  2. On the Add Widget window, select the widget or widgets that should be accessible with the API key.
     select widgets
  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 widget
  4. Click Add Selected once you confirm the list is correct. 
  5. Then you will see the selected widget in the widget list.

Image Added

Stop connecting your data to the API

Unbinding your data 

...

To disconnect and unbind data to the API ,

  1. click the Delete icon for the datasets and widgets. 
    Image Modified
  2. Click 

...

  1. Confirm to finish the deletion. 
    confirm deletionImage Modified

Enable Public API Switch 

...

The Enable Public API  switch feature is the global switch that controls the availability of the Public API feature. The To activate, switch the Enable Public API toggle ON.  If disabled, the API Keys and all connected data will not be available if this switch is OFF or disabledbe inaccessible

enable public api

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.

...

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

REQUEST


Image RemovedImage Added

RESPONSE


GET REQUEST (Widget)

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

REQUEST

Image RemovedImage Added

RESPONSE

Supported query criteria

...

(Please Note: Currently, widgets that include measure or calculate layers are not supported.)

sample URL with conditions:

dataset: https://api.mspbots.ai/api/dataset/{resourceId}1?current=1&size=2&project_name=back

widget: https://api.mspbots.ai/api/widget/{resourceId}?current=1&size=10&Real Name=n&Update Date=2021-10-10,2023-03-30,2023-04-05&Id=,1534956341424005122

Logical OperatorsField Typeexample
TEXTNUMBERBOOLEANDATEDATETIME
Is Emptystatus=
Contains



name=Tod
Equals


is_default=true
id=654321324612312
Later Than (>=)

price=12.6,
date=2022-07-01
Earlier Than (<=)



price=,56.3
between (>= and <=)

price=12.6,56.3
date=2022-07-01,2023-02-01
Multiple intervals
(>= and <=) or (>= and <=)


price=12.6,56.3,103,210
date=2022-07-01,2023-02-01,2023-04-01,2023-05-01
(>= and <=) or (=)



price=12.6,56.3,105.1
(>= and <=) or (>=)


date=2022-07-01,2023-02-01,2023-04-01

Sample Error Responses 

...

  1. Rate limits
  2. Invalid apiKey: Error or deleted
  3. Resource unbound
  4. The resource does not exist
  5. HTTP 502 error status code, please refer to Receiving HTTP 502 Error Status Code When Fetching Data Requests from Widget Using Public API for resolution.
    Image Added

Related Topics

...

Content by Label
showLabelsfalse
showSpacefalse
excludeCurrenttrue
cqllabel = "public"