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));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();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/notification/fcm-creds");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\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}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
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
}User App
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));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();using RestSharp;
var options = new RestClientOptions("https://api.eka.care/notification/fcm-creds");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
request.AddJsonBody("{\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}", false);
var response = await client.PostAsync(request);
Console.WriteLine("{0}", response.Content);
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
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"
}
} ```
Response
Successful response
The response is of type object.
Was this page helpful?

