REST API Overview

Last updated:2023-02-28

Basic

  • API is designed to comply with HTTP and REST specifications. For example, the Get method is used for query requests and the POST method is used for submission requests. If a request is not a corresponding HTTP method, an error is returned
  • If there is no special description, the value of the call parameter should be transcoded as UTF-8, URL Coding

API Resource List

Content Base URL Description
Create a push API https://webpush.api.engagelab.cc/v4/push Push Message API
Statistical API https://webpush.api.engagelab.cc/v4 Obtain statistics data
Scheduled task API https://webpush.api.engagelab.cc/v4/schedules Manage scheduled push tasks

Authentication Method

Engagelab REST API uses HTTP basic authentication The basic method is to add HTTP Header Authorization (Header)::

Authorization: Basic base64_auth_string
          Authorization: Basic base64_auth_string

        
This code block in the floating window

The base64_auth_String generation algorithm isbase64(appKey:masterSecret)
That is, add a colon to the appKey, add the masterSecret assembled string, and then perform base64 conversion
Go to the application settings-application information page to obtain the appKey and masterSecret parameters
image.png

Authentication Example

If your appKey is "c96f42e0d2e662e45d035ab1", and masterSecret is "df4d59e84eac2f9d53b36f12",when you call Push API v4, use the curl Command to call the following:

curl --insecure -X POST -v https://webpush.api.engagelab.cc/v4/push -H "Content-Type: application/json" -u "c96f42e0d2e662e45d035ab1:df4d59e84eac2f9d53b36f12" -d '{"from":"push","to":"all","body":{"platform":"web","notification":{"alert":"Hi,MTPush !","web":{"alert":"Hi,MTPush !", "title":"web_push", "url":"http://www.google.com","extras":{"web-key1":"web-value1"}}}},"request_id":"12345678", "custom_args":"business info"}'
           curl --insecure -X POST -v https://webpush.api.engagelab.cc/v4/push 
-H "Content-Type: application/json" 
-u "c96f42e0d2e662e45d035ab1:df4d59e84eac2f9d53b36f12" 
-d '{"from":"push","to":"all","body":{"platform":"web","notification":{"alert":"Hi,MTPush !","web":{"alert":"Hi,MTPush !", "title":"web_push", "url":"http://www.google.com","extras":{"web-key1":"web-value1"}}}},"request_id":"12345678", "custom_args":"business info"}'

        
This code block in the floating window

The HTTP request is:

> POST /v4/push HTTP/1.1 > Authorization: Basic Yzk2ZjQyZTBkMmU2NjJlNDVkMDM1YWIxOmRmNGQ1OWU4NGVhYzJmOWQ1M2IzNmYxMg==
          > POST /v4/push HTTP/1.1
> Authorization: Basic Yzk2ZjQyZTBkMmU2NjJlNDVkMDM1YWIxOmRmNGQ1OWU4NGVhYzJmOWQ1M2IzNmYxMg==

        
This code block in the floating window
在文档中心打开