API tool
    • 13 Apr 2023
    • 1 Minute to read
    • Dark
      Light
    • PDF

    API tool

    • Dark
      Light
    • PDF

    Article summary

    RESTful API

    The Nodegrid Platform provides an embedded RESTful API. This provides API calls to access and modify the Nodegrid device configuration. Displays this dialog.

    1. Go to System :: Toolkit.
    2. Click on the API icon.
      Alternatively, on Banner, User Name drop-down (top right), click API Documentation.
    3. On the left panel, click the Right-arrow to display API calls for that function. Request and Response examples are included.

    Example: "get auditing email destination configuration"

    gRPC

    The gRPC framework is supported (default: disabled). To enable gRPC:

    1. Go to Security :: .Services.
    2. In Active Servicesmenu, enter details:
      1. Select Enable gRPC checkbox.
      2. Enter gRPC Port
    3. Click Save.

    gRPC is very scalable, performance-based RPC framework that uses simple service definitions and structured data.

    There are four service definitions:

    • get_request (APIRequest) - reads data. Returns (APIReply).
    • post_request (APIRequest) - executes commands or add an entry. Returns (APIReply).
    • put_request (APIRequest) - executes commands that need a selected entry or update an entry. Returns (APIReply).
    • delete_request (APIRequest) - deletes existing data sets (or destroys a session). Returns (APIReply).

    APIRequest expects three arguments:

    • path - gRPC path to be used.
    • ticket - authentication ticket for the request.
    • data - structured data, in json format.

    All three arguments follow the same structure as the existing REST API's. See https://<Nodegrid IP>/api_doc.html for more details.

    APIReply returns two arguments:

    • message - structured data in json format
    • status_code - status_code as int32 number

    Examples

    post_request (Authentication - returns a session ticket)

    post_request({path: '/v1/Session', data: '{"username": "admin", "password": "admin"}'}, [...]

    get_request (get network connection details)

    get_request({path: '/v1/network/connections', ticket: 'xxxxxxxxxxxxx'}, [...]

    post_request (add a phone number to the sms whitelist)

    post_request({path: '/v1/system/sms/whitelist', ticket: 'xxxxxxxxxxxxx', data '{"name": "phone1", "phone_number": "+111111111111"}' }, [...]

    put_request (update an existing value on the sms whitelist)

    put_request({path: '/v1/system/sms/whitelist/phone1', ticket: 'xxxxxxxxxxxxx', data '{"phone_number": "+122222222222"}' }, [...]

    delete_request (delete an existing value on the sms whitelist)

    delete_request({path: '/v1/system/sms/whitelist', ticket: 'xxxxxxxxxxxxx', data '{"whitelists": [ "phone1", "phone2" ]}' }, [...]



    Was this article helpful?

    ESC

    Eddy AI, facilitating knowledge discovery through conversational intelligence