Add FCM Credentials
curl --request POST \
--url https://api.eka.care/notification/fcm-creds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sa_key": {
"type": "service_account",
"project_id": "example-project",
"private_key_id": "1234567890abcdef",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\n-----END PRIVATE KEY-----\\n",
"client_email": "example@example.iam.gserviceaccount.com",
"client_id": 12345678901234567000,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com",
"universal_domain": "example.com"
}
}
'import requests
url = "https://api.eka.care/notification/fcm-creds"
payload = { "sa_key": {
"type": "service_account",
"project_id": "example-project",
"private_key_id": "1234567890abcdef",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\n-----END PRIVATE KEY-----\n",
"client_email": "example@example.iam.gserviceaccount.com",
"client_id": 12345678901234567000,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com",
"universal_domain": "example.com"
} }
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({
sa_key: {
type: 'service_account',
project_id: 'example-project',
private_key_id: '1234567890abcdef',
private_key: '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\n-----END PRIVATE KEY-----\n',
client_email: 'example@example.iam.gserviceaccount.com',
client_id: 12345678901234567000,
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
token_uri: 'https://oauth2.googleapis.com/token',
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
client_x509_cert_url: 'https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com',
universal_domain: 'example.com'
}
})
};
fetch('https://api.eka.care/notification/fcm-creds', 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/fcm-creds",
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([
'sa_key' => [
'type' => 'service_account',
'project_id' => 'example-project',
'private_key_id' => '1234567890abcdef',
'private_key' => '-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\n-----END PRIVATE KEY-----\\n',
'client_email' => 'example@example.iam.gserviceaccount.com',
'client_id' => 12345678901234567000,
'auth_uri' => 'https://accounts.google.com/o/oauth2/auth',
'token_uri' => 'https://oauth2.googleapis.com/token',
'auth_provider_x509_cert_url' => 'https://www.googleapis.com/oauth2/v1/certs',
'client_x509_cert_url' => 'https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com',
'universal_domain' => 'example.com'
]
]),
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/fcm-creds"
payload := strings.NewReader("{\n \"sa_key\": {\n \"type\": \"service_account\",\n \"project_id\": \"example-project\",\n \"private_key_id\": \"1234567890abcdef\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\\\n-----END PRIVATE KEY-----\\\\n\",\n \"client_email\": \"example@example.iam.gserviceaccount.com\",\n \"client_id\": 12345678901234567000,\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com\",\n \"universal_domain\": \"example.com\"\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/fcm-creds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sa_key\": {\n \"type\": \"service_account\",\n \"project_id\": \"example-project\",\n \"private_key_id\": \"1234567890abcdef\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\\\n-----END PRIVATE KEY-----\\\\n\",\n \"client_email\": \"example@example.iam.gserviceaccount.com\",\n \"client_id\": 12345678901234567000,\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com\",\n \"universal_domain\": \"example.com\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/notification/fcm-creds")
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 \"sa_key\": {\n \"type\": \"service_account\",\n \"project_id\": \"example-project\",\n \"private_key_id\": \"1234567890abcdef\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\\\n-----END PRIVATE KEY-----\\\\n\",\n \"client_email\": \"example@example.iam.gserviceaccount.com\",\n \"client_id\": 12345678901234567000,\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com\",\n \"universal_domain\": \"example.com\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "FCM token added successfully"
}{
"message": "Unauthorized access.",
"error_code": 401
}{
"message": "Internal server error.",
"error_code": 500
}Notifications
Add FCM Credentials
Store FCM credentials. This endpoint allows clients to store Firebase Cloud Messaging (FCM) credentials by providing the service account key details. The stored credentials will be used for sending notifications to the registered devices. The request body must contain the FCM payload information.
POST
/
notification
/
fcm-creds
Add FCM Credentials
curl --request POST \
--url https://api.eka.care/notification/fcm-creds \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sa_key": {
"type": "service_account",
"project_id": "example-project",
"private_key_id": "1234567890abcdef",
"private_key": "-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\n-----END PRIVATE KEY-----\\n",
"client_email": "example@example.iam.gserviceaccount.com",
"client_id": 12345678901234567000,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com",
"universal_domain": "example.com"
}
}
'import requests
url = "https://api.eka.care/notification/fcm-creds"
payload = { "sa_key": {
"type": "service_account",
"project_id": "example-project",
"private_key_id": "1234567890abcdef",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\n-----END PRIVATE KEY-----\n",
"client_email": "example@example.iam.gserviceaccount.com",
"client_id": 12345678901234567000,
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com",
"universal_domain": "example.com"
} }
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({
sa_key: {
type: 'service_account',
project_id: 'example-project',
private_key_id: '1234567890abcdef',
private_key: '-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\n-----END PRIVATE KEY-----\n',
client_email: 'example@example.iam.gserviceaccount.com',
client_id: 12345678901234567000,
auth_uri: 'https://accounts.google.com/o/oauth2/auth',
token_uri: 'https://oauth2.googleapis.com/token',
auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs',
client_x509_cert_url: 'https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com',
universal_domain: 'example.com'
}
})
};
fetch('https://api.eka.care/notification/fcm-creds', 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/fcm-creds",
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([
'sa_key' => [
'type' => 'service_account',
'project_id' => 'example-project',
'private_key_id' => '1234567890abcdef',
'private_key' => '-----BEGIN PRIVATE KEY-----\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\n-----END PRIVATE KEY-----\\n',
'client_email' => 'example@example.iam.gserviceaccount.com',
'client_id' => 12345678901234567000,
'auth_uri' => 'https://accounts.google.com/o/oauth2/auth',
'token_uri' => 'https://oauth2.googleapis.com/token',
'auth_provider_x509_cert_url' => 'https://www.googleapis.com/oauth2/v1/certs',
'client_x509_cert_url' => 'https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com',
'universal_domain' => 'example.com'
]
]),
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/fcm-creds"
payload := strings.NewReader("{\n \"sa_key\": {\n \"type\": \"service_account\",\n \"project_id\": \"example-project\",\n \"private_key_id\": \"1234567890abcdef\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\\\n-----END PRIVATE KEY-----\\\\n\",\n \"client_email\": \"example@example.iam.gserviceaccount.com\",\n \"client_id\": 12345678901234567000,\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com\",\n \"universal_domain\": \"example.com\"\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/fcm-creds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"sa_key\": {\n \"type\": \"service_account\",\n \"project_id\": \"example-project\",\n \"private_key_id\": \"1234567890abcdef\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\\\n-----END PRIVATE KEY-----\\\\n\",\n \"client_email\": \"example@example.iam.gserviceaccount.com\",\n \"client_id\": 12345678901234567000,\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com\",\n \"universal_domain\": \"example.com\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eka.care/notification/fcm-creds")
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 \"sa_key\": {\n \"type\": \"service_account\",\n \"project_id\": \"example-project\",\n \"private_key_id\": \"1234567890abcdef\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\\\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASC...\\\\n-----END PRIVATE KEY-----\\\\n\",\n \"client_email\": \"example@example.iam.gserviceaccount.com\",\n \"client_id\": 12345678901234567000,\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/example@example.iam.gserviceaccount.com\",\n \"universal_domain\": \"example.com\"\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "FCM token added successfully"
}{
"message": "Unauthorized access.",
"error_code": 401
}{
"message": "Internal server error.",
"error_code": 500
}Authorizations
The API requires a Bearer token in the Authorization header for authentication.
Body
application/json
The request body must contain the FCM payload information. The format should be:
"sa_key": {
"type": "string",
"project_id": "string",
"private_key_id": "string",
"private_key": "string",
"client_email": "string",
"client_id": "string",
"auth_uri": "string",
"token_uri": "string",
"auth_provider_x509_cert_url": "string",
"client_x509_cert_url": "string",
"universal_domain": "string"
}
} ```Show child attributes
Show child attributes
Response
Successful response
The response is of type object.
Was this page helpful?
⌘I

