Skip to main content
POST
/
notification
/
add-device
Add Device
curl --request POST \
  --url https://api.eka.care/notification/add-device \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "devicePayload": {
    "app-id": "123",
    "app-platform": "android",
    "app-version": "1571",
    "did": "aa8650d03",
    "fcm-id": "fr3Ybq-2QHW_Jp:CivqQlS6tZZZ",
    "fid": "frbq-2Qkh",
    "lang": "en",
    "os-version": 20,
    "user-hash": "user123"
  }
}
'
import requests

url = "https://api.eka.care/notification/add-device"

payload = { "devicePayload": {
        "app-id": "123",
        "app-platform": "android",
        "app-version": "1571",
        "did": "aa8650d03",
        "fcm-id": "fr3Ybq-2QHW_Jp:CivqQlS6tZZZ",
        "fid": "frbq-2Qkh",
        "lang": "en",
        "os-version": 20,
        "user-hash": "user123"
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    devicePayload: {
      'app-id': '123',
      'app-platform': 'android',
      'app-version': '1571',
      did: 'aa8650d03',
      'fcm-id': 'fr3Ybq-2QHW_Jp:CivqQlS6tZZZ',
      fid: 'frbq-2Qkh',
      lang: 'en',
      'os-version': 20,
      'user-hash': 'user123'
    }
  })
};

fetch('https://api.eka.care/notification/add-device', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.eka.care/notification/add-device",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'devicePayload' => [
        'app-id' => '123',
        'app-platform' => 'android',
        'app-version' => '1571',
        'did' => 'aa8650d03',
        'fcm-id' => 'fr3Ybq-2QHW_Jp:CivqQlS6tZZZ',
        'fid' => 'frbq-2Qkh',
        'lang' => 'en',
        'os-version' => 20,
        'user-hash' => 'user123'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.eka.care/notification/add-device"

	payload := strings.NewReader("{\n  \"devicePayload\": {\n    \"app-id\": \"123\",\n    \"app-platform\": \"android\",\n    \"app-version\": \"1571\",\n    \"did\": \"aa8650d03\",\n    \"fcm-id\": \"fr3Ybq-2QHW_Jp:CivqQlS6tZZZ\",\n    \"fid\": \"frbq-2Qkh\",\n    \"lang\": \"en\",\n    \"os-version\": 20,\n    \"user-hash\": \"user123\"\n  }\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.eka.care/notification/add-device")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"devicePayload\": {\n    \"app-id\": \"123\",\n    \"app-platform\": \"android\",\n    \"app-version\": \"1571\",\n    \"did\": \"aa8650d03\",\n    \"fcm-id\": \"fr3Ybq-2QHW_Jp:CivqQlS6tZZZ\",\n    \"fid\": \"frbq-2Qkh\",\n    \"lang\": \"en\",\n    \"os-version\": 20,\n    \"user-hash\": \"user123\"\n  }\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.eka.care/notification/add-device")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"devicePayload\": {\n    \"app-id\": \"123\",\n    \"app-platform\": \"android\",\n    \"app-version\": \"1571\",\n    \"did\": \"aa8650d03\",\n    \"fcm-id\": \"fr3Ybq-2QHW_Jp:CivqQlS6tZZZ\",\n    \"fid\": \"frbq-2Qkh\",\n    \"lang\": \"en\",\n    \"os-version\": 20,\n    \"user-hash\": \"user123\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "success": true
}
{
  "message": "Unauthorized access.",
  "error_code": 401
}
{
  "message": "Internal server error.",
  "error_code": 500
}

Authorizations

Authorization
string
header
required

The API requires a Bearer token in the Authorization header for authentication.

Body

application/json

The request body must contain the device payload information. The format should be:

  "devicePayload": {
    "app-id": "string",
    "app-platform": "string",
    "app-version": "string",
    "did": "string",
    "fcm-id": "string",
    "fid": "string",
    "lang": "string",
    "os-version": "integer",
    "user-hash": "string"
  }
} ```
devicePayload
object

Response

Successful response

The response is of type object.