Get Specific Content Blocks
curl --request POST \
--url https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <api-key>' \
--data '
{
"ids": [
"634fdf4db9c206ba55b8223b"
],
"is_raw_content_required": true
}
'import requests
url = "https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids"
payload = {
"ids": ["634fdf4db9c206ba55b8223b"],
"is_raw_content_required": True
}
headers = {
"MOE-APPKEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'MOE-APPKEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['634fdf4db9c206ba55b8223b'], is_raw_content_required: true})
};
fetch('https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids', 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-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids",
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([
'ids' => [
'634fdf4db9c206ba55b8223b'
],
'is_raw_content_required' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"MOE-APPKEY: <api-key>"
],
]);
$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-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids"
payload := strings.NewReader("{\n \"ids\": [\n \"634fdf4db9c206ba55b8223b\"\n ],\n \"is_raw_content_required\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("MOE-APPKEY", "<api-key>")
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-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids")
.header("MOE-APPKEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"634fdf4db9c206ba55b8223b\"\n ],\n \"is_raw_content_required\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["MOE-APPKEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"634fdf4db9c206ba55b8223b\"\n ],\n \"is_raw_content_required\": true\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "634fdf4db9c206ba55b8223ab",
"name": "Contentblocktest2",
"label": "Contentblocktest2",
"description": "",
"content_type": "TEXT",
"content": "aa",
"raw_content": "aa",
"status": "ACTIVE",
"created_by": "user@email.com",
"created_at": "2022-10-19T11:28:13.925000",
"updated_by": "test",
"updated_at": "2022-10-21T08:38:51.419000",
"tag_ids": [
"0"
],
"team_ids": [
"test"
],
"images_used": []
}
]
}{
"title": "Invalid Field Value",
"description": "app_key - Some of the field values are invalid: app_key : None",
"code": "nGpUNpDQ"
}{
"title": "Internal Server Error",
"description": "An unexpected error occurred on the server.",
"code": "SRV_ERR_123"
}Custom Content Blocks
Get Specific Content Blocks
You can use this API to get specific content blocks from the available content blocks in your MoEngage account.
POST
/
content-blocks
/
get-by-ids
Get Specific Content Blocks
curl --request POST \
--url https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids \
--header 'Content-Type: application/json' \
--header 'MOE-APPKEY: <api-key>' \
--data '
{
"ids": [
"634fdf4db9c206ba55b8223b"
],
"is_raw_content_required": true
}
'import requests
url = "https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids"
payload = {
"ids": ["634fdf4db9c206ba55b8223b"],
"is_raw_content_required": True
}
headers = {
"MOE-APPKEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'MOE-APPKEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({ids: ['634fdf4db9c206ba55b8223b'], is_raw_content_required: true})
};
fetch('https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids', 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-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids",
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([
'ids' => [
'634fdf4db9c206ba55b8223b'
],
'is_raw_content_required' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"MOE-APPKEY: <api-key>"
],
]);
$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-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids"
payload := strings.NewReader("{\n \"ids\": [\n \"634fdf4db9c206ba55b8223b\"\n ],\n \"is_raw_content_required\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("MOE-APPKEY", "<api-key>")
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-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids")
.header("MOE-APPKEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"ids\": [\n \"634fdf4db9c206ba55b8223b\"\n ],\n \"is_raw_content_required\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-0{dc}.moengage.com/v1/external/campaigns/content-blocks/get-by-ids")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["MOE-APPKEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"ids\": [\n \"634fdf4db9c206ba55b8223b\"\n ],\n \"is_raw_content_required\": true\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"id": "634fdf4db9c206ba55b8223ab",
"name": "Contentblocktest2",
"label": "Contentblocktest2",
"description": "",
"content_type": "TEXT",
"content": "aa",
"raw_content": "aa",
"status": "ACTIVE",
"created_by": "user@email.com",
"created_at": "2022-10-19T11:28:13.925000",
"updated_by": "test",
"updated_at": "2022-10-21T08:38:51.419000",
"tag_ids": [
"0"
],
"team_ids": [
"test"
],
"images_used": []
}
]
}{
"title": "Invalid Field Value",
"description": "app_key - Some of the field values are invalid: app_key : None",
"code": "nGpUNpDQ"
}{
"title": "Internal Server Error",
"description": "An unexpected error occurred on the server.",
"code": "SRV_ERR_123"
}Authorizations
Your MoEngage Workspace ID (App Key). You can find this at Settings -> Account -> APIs -> Workspace ID.
Body
application/json
Response
Success
Show child attributes
Show child attributes
Was this page helpful?
⌘I