curl --request POST \
--url https://api.partoo.co/v2/posts \
--header 'Content-Type: application/json' \
--header 'x-APIKey: <api-key>' \
--data '
{
"business_search": {
"business__in": [
[
"5409c35a97bbc544d8e26737",
"595badaef348ab6b3530033f",
"59d53302b12ff6429f262639"
]
]
},
"publishers": [
"google_my_business",
"facebook",
"instagram"
],
"data": {
"summary": "Wonderful post summary !",
"image_url": [
"https://example.com/1.png",
"https://example.com/2.png"
],
"title": "Great post title !",
"link": {
"use_business_url": true,
"custom_url": "<string>"
},
"schedule_time": "2050-01-01T09:00:00",
"expiration_time": "2050-01-01T09:00:00",
"coupon_code": "PROMO25",
"offer_terms": "These are the conditions",
"start_at": "2050-01-01T09:00:00",
"end_at": "2050-01-01T09:00:00"
},
"is_draft": false,
"send_notifications": false
}
'import requests
url = "https://api.partoo.co/v2/posts"
payload = {
"business_search": { "business__in": [["5409c35a97bbc544d8e26737", "595badaef348ab6b3530033f", "59d53302b12ff6429f262639"]] },
"publishers": ["google_my_business", "facebook", "instagram"],
"data": {
"summary": "Wonderful post summary !",
"image_url": ["https://example.com/1.png", "https://example.com/2.png"],
"title": "Great post title !",
"link": {
"use_business_url": True,
"custom_url": "<string>"
},
"schedule_time": "2050-01-01T09:00:00",
"expiration_time": "2050-01-01T09:00:00",
"coupon_code": "PROMO25",
"offer_terms": "These are the conditions",
"start_at": "2050-01-01T09:00:00",
"end_at": "2050-01-01T09:00:00"
},
"is_draft": False,
"send_notifications": False
}
headers = {
"x-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
business_search: {
business__in: [
[
'5409c35a97bbc544d8e26737',
'595badaef348ab6b3530033f',
'59d53302b12ff6429f262639'
]
]
},
publishers: ['google_my_business', 'facebook', 'instagram'],
data: {
summary: 'Wonderful post summary !',
image_url: ['https://example.com/1.png', 'https://example.com/2.png'],
title: 'Great post title !',
link: {use_business_url: true, custom_url: '<string>'},
schedule_time: '2050-01-01T09:00:00',
expiration_time: '2050-01-01T09:00:00',
coupon_code: 'PROMO25',
offer_terms: 'These are the conditions',
start_at: '2050-01-01T09:00:00',
end_at: '2050-01-01T09:00:00'
},
is_draft: false,
send_notifications: false
})
};
fetch('https://api.partoo.co/v2/posts', 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.partoo.co/v2/posts",
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([
'business_search' => [
'business__in' => [
[
'5409c35a97bbc544d8e26737',
'595badaef348ab6b3530033f',
'59d53302b12ff6429f262639'
]
]
],
'publishers' => [
'google_my_business',
'facebook',
'instagram'
],
'data' => [
'summary' => 'Wonderful post summary !',
'image_url' => [
'https://example.com/1.png',
'https://example.com/2.png'
],
'title' => 'Great post title !',
'link' => [
'use_business_url' => true,
'custom_url' => '<string>'
],
'schedule_time' => '2050-01-01T09:00:00',
'expiration_time' => '2050-01-01T09:00:00',
'coupon_code' => 'PROMO25',
'offer_terms' => 'These are the conditions',
'start_at' => '2050-01-01T09:00:00',
'end_at' => '2050-01-01T09:00:00'
],
'is_draft' => false,
'send_notifications' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-APIKey: <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.partoo.co/v2/posts"
payload := strings.NewReader("{\n \"business_search\": {\n \"business__in\": [\n [\n \"5409c35a97bbc544d8e26737\",\n \"595badaef348ab6b3530033f\",\n \"59d53302b12ff6429f262639\"\n ]\n ]\n },\n \"publishers\": [\n \"google_my_business\",\n \"facebook\",\n \"instagram\"\n ],\n \"data\": {\n \"summary\": \"Wonderful post summary !\",\n \"image_url\": [\n \"https://example.com/1.png\",\n \"https://example.com/2.png\"\n ],\n \"title\": \"Great post title !\",\n \"link\": {\n \"use_business_url\": true,\n \"custom_url\": \"<string>\"\n },\n \"schedule_time\": \"2050-01-01T09:00:00\",\n \"expiration_time\": \"2050-01-01T09:00:00\",\n \"coupon_code\": \"PROMO25\",\n \"offer_terms\": \"These are the conditions\",\n \"start_at\": \"2050-01-01T09:00:00\",\n \"end_at\": \"2050-01-01T09:00:00\"\n },\n \"is_draft\": false,\n \"send_notifications\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-APIKey", "<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.partoo.co/v2/posts")
.header("x-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"business_search\": {\n \"business__in\": [\n [\n \"5409c35a97bbc544d8e26737\",\n \"595badaef348ab6b3530033f\",\n \"59d53302b12ff6429f262639\"\n ]\n ]\n },\n \"publishers\": [\n \"google_my_business\",\n \"facebook\",\n \"instagram\"\n ],\n \"data\": {\n \"summary\": \"Wonderful post summary !\",\n \"image_url\": [\n \"https://example.com/1.png\",\n \"https://example.com/2.png\"\n ],\n \"title\": \"Great post title !\",\n \"link\": {\n \"use_business_url\": true,\n \"custom_url\": \"<string>\"\n },\n \"schedule_time\": \"2050-01-01T09:00:00\",\n \"expiration_time\": \"2050-01-01T09:00:00\",\n \"coupon_code\": \"PROMO25\",\n \"offer_terms\": \"These are the conditions\",\n \"start_at\": \"2050-01-01T09:00:00\",\n \"end_at\": \"2050-01-01T09:00:00\"\n },\n \"is_draft\": false,\n \"send_notifications\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.partoo.co/v2/posts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_search\": {\n \"business__in\": [\n [\n \"5409c35a97bbc544d8e26737\",\n \"595badaef348ab6b3530033f\",\n \"59d53302b12ff6429f262639\"\n ]\n ]\n },\n \"publishers\": [\n \"google_my_business\",\n \"facebook\",\n \"instagram\"\n ],\n \"data\": {\n \"summary\": \"Wonderful post summary !\",\n \"image_url\": [\n \"https://example.com/1.png\",\n \"https://example.com/2.png\"\n ],\n \"title\": \"Great post title !\",\n \"link\": {\n \"use_business_url\": true,\n \"custom_url\": \"<string>\"\n },\n \"schedule_time\": \"2050-01-01T09:00:00\",\n \"expiration_time\": \"2050-01-01T09:00:00\",\n \"coupon_code\": \"PROMO25\",\n \"offer_terms\": \"These are the conditions\",\n \"start_at\": \"2050-01-01T09:00:00\",\n \"end_at\": \"2050-01-01T09:00:00\"\n },\n \"is_draft\": false,\n \"send_notifications\": false\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 200,
"message": "2 posts have been created.",
"ids": "45,46",
"data": [
{
"post_id": 101,
"business_id": "1234567890"
},
{
"post_id": 102,
"business_id": "1234567891"
}
]
}{
"errors": {
"authentication": "User not authenticated"
}
}{
"errors": {
"authorization": "Operation not allowed"
}
}{
"errors": {
"json": "Resource not found"
}
}Create a post
This endpoint lets you create a post or a draft post on Google / Facebook / Instagram.
The creation of a post will not happen in real time and might take a few minutes.
A draft post can only be created by Org Admins and is not immediately published. An expiration date must be specified when creating a draft post. In order to be published, a draft needs to be updated by a BM/GM user before the expiration date.
curl --request POST \
--url https://api.partoo.co/v2/posts \
--header 'Content-Type: application/json' \
--header 'x-APIKey: <api-key>' \
--data '
{
"business_search": {
"business__in": [
[
"5409c35a97bbc544d8e26737",
"595badaef348ab6b3530033f",
"59d53302b12ff6429f262639"
]
]
},
"publishers": [
"google_my_business",
"facebook",
"instagram"
],
"data": {
"summary": "Wonderful post summary !",
"image_url": [
"https://example.com/1.png",
"https://example.com/2.png"
],
"title": "Great post title !",
"link": {
"use_business_url": true,
"custom_url": "<string>"
},
"schedule_time": "2050-01-01T09:00:00",
"expiration_time": "2050-01-01T09:00:00",
"coupon_code": "PROMO25",
"offer_terms": "These are the conditions",
"start_at": "2050-01-01T09:00:00",
"end_at": "2050-01-01T09:00:00"
},
"is_draft": false,
"send_notifications": false
}
'import requests
url = "https://api.partoo.co/v2/posts"
payload = {
"business_search": { "business__in": [["5409c35a97bbc544d8e26737", "595badaef348ab6b3530033f", "59d53302b12ff6429f262639"]] },
"publishers": ["google_my_business", "facebook", "instagram"],
"data": {
"summary": "Wonderful post summary !",
"image_url": ["https://example.com/1.png", "https://example.com/2.png"],
"title": "Great post title !",
"link": {
"use_business_url": True,
"custom_url": "<string>"
},
"schedule_time": "2050-01-01T09:00:00",
"expiration_time": "2050-01-01T09:00:00",
"coupon_code": "PROMO25",
"offer_terms": "These are the conditions",
"start_at": "2050-01-01T09:00:00",
"end_at": "2050-01-01T09:00:00"
},
"is_draft": False,
"send_notifications": False
}
headers = {
"x-APIKey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-APIKey': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
business_search: {
business__in: [
[
'5409c35a97bbc544d8e26737',
'595badaef348ab6b3530033f',
'59d53302b12ff6429f262639'
]
]
},
publishers: ['google_my_business', 'facebook', 'instagram'],
data: {
summary: 'Wonderful post summary !',
image_url: ['https://example.com/1.png', 'https://example.com/2.png'],
title: 'Great post title !',
link: {use_business_url: true, custom_url: '<string>'},
schedule_time: '2050-01-01T09:00:00',
expiration_time: '2050-01-01T09:00:00',
coupon_code: 'PROMO25',
offer_terms: 'These are the conditions',
start_at: '2050-01-01T09:00:00',
end_at: '2050-01-01T09:00:00'
},
is_draft: false,
send_notifications: false
})
};
fetch('https://api.partoo.co/v2/posts', 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.partoo.co/v2/posts",
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([
'business_search' => [
'business__in' => [
[
'5409c35a97bbc544d8e26737',
'595badaef348ab6b3530033f',
'59d53302b12ff6429f262639'
]
]
],
'publishers' => [
'google_my_business',
'facebook',
'instagram'
],
'data' => [
'summary' => 'Wonderful post summary !',
'image_url' => [
'https://example.com/1.png',
'https://example.com/2.png'
],
'title' => 'Great post title !',
'link' => [
'use_business_url' => true,
'custom_url' => '<string>'
],
'schedule_time' => '2050-01-01T09:00:00',
'expiration_time' => '2050-01-01T09:00:00',
'coupon_code' => 'PROMO25',
'offer_terms' => 'These are the conditions',
'start_at' => '2050-01-01T09:00:00',
'end_at' => '2050-01-01T09:00:00'
],
'is_draft' => false,
'send_notifications' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-APIKey: <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.partoo.co/v2/posts"
payload := strings.NewReader("{\n \"business_search\": {\n \"business__in\": [\n [\n \"5409c35a97bbc544d8e26737\",\n \"595badaef348ab6b3530033f\",\n \"59d53302b12ff6429f262639\"\n ]\n ]\n },\n \"publishers\": [\n \"google_my_business\",\n \"facebook\",\n \"instagram\"\n ],\n \"data\": {\n \"summary\": \"Wonderful post summary !\",\n \"image_url\": [\n \"https://example.com/1.png\",\n \"https://example.com/2.png\"\n ],\n \"title\": \"Great post title !\",\n \"link\": {\n \"use_business_url\": true,\n \"custom_url\": \"<string>\"\n },\n \"schedule_time\": \"2050-01-01T09:00:00\",\n \"expiration_time\": \"2050-01-01T09:00:00\",\n \"coupon_code\": \"PROMO25\",\n \"offer_terms\": \"These are the conditions\",\n \"start_at\": \"2050-01-01T09:00:00\",\n \"end_at\": \"2050-01-01T09:00:00\"\n },\n \"is_draft\": false,\n \"send_notifications\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-APIKey", "<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.partoo.co/v2/posts")
.header("x-APIKey", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"business_search\": {\n \"business__in\": [\n [\n \"5409c35a97bbc544d8e26737\",\n \"595badaef348ab6b3530033f\",\n \"59d53302b12ff6429f262639\"\n ]\n ]\n },\n \"publishers\": [\n \"google_my_business\",\n \"facebook\",\n \"instagram\"\n ],\n \"data\": {\n \"summary\": \"Wonderful post summary !\",\n \"image_url\": [\n \"https://example.com/1.png\",\n \"https://example.com/2.png\"\n ],\n \"title\": \"Great post title !\",\n \"link\": {\n \"use_business_url\": true,\n \"custom_url\": \"<string>\"\n },\n \"schedule_time\": \"2050-01-01T09:00:00\",\n \"expiration_time\": \"2050-01-01T09:00:00\",\n \"coupon_code\": \"PROMO25\",\n \"offer_terms\": \"These are the conditions\",\n \"start_at\": \"2050-01-01T09:00:00\",\n \"end_at\": \"2050-01-01T09:00:00\"\n },\n \"is_draft\": false,\n \"send_notifications\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.partoo.co/v2/posts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-APIKey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"business_search\": {\n \"business__in\": [\n [\n \"5409c35a97bbc544d8e26737\",\n \"595badaef348ab6b3530033f\",\n \"59d53302b12ff6429f262639\"\n ]\n ]\n },\n \"publishers\": [\n \"google_my_business\",\n \"facebook\",\n \"instagram\"\n ],\n \"data\": {\n \"summary\": \"Wonderful post summary !\",\n \"image_url\": [\n \"https://example.com/1.png\",\n \"https://example.com/2.png\"\n ],\n \"title\": \"Great post title !\",\n \"link\": {\n \"use_business_url\": true,\n \"custom_url\": \"<string>\"\n },\n \"schedule_time\": \"2050-01-01T09:00:00\",\n \"expiration_time\": \"2050-01-01T09:00:00\",\n \"coupon_code\": \"PROMO25\",\n \"offer_terms\": \"These are the conditions\",\n \"start_at\": \"2050-01-01T09:00:00\",\n \"end_at\": \"2050-01-01T09:00:00\"\n },\n \"is_draft\": false,\n \"send_notifications\": false\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"code": 200,
"message": "2 posts have been created.",
"ids": "45,46",
"data": [
{
"post_id": 101,
"business_id": "1234567890"
},
{
"post_id": 102,
"business_id": "1234567891"
}
]
}{
"errors": {
"authentication": "User not authenticated"
}
}{
"errors": {
"authorization": "Operation not allowed"
}
}{
"errors": {
"json": "Resource not found"
}
}Authorizations
The authentication system on Partoo API is using API Key that should be put in the header of the request (the name of the header is x-APIKey). An api_key is linked to a user. This user's role will give you different access level to the API features.
Body
Request body to create a Post
Business to create post
Show child attributes
Show child attributes
List of publisher to diffuse the post
google_my_business, facebook, instagram [
"google_my_business",
"facebook",
"instagram"
]Information on post to create
Show child attributes
Show child attributes
If true, the post will be created as a draft. You must then also specify an expiration_time in the body's data.
If true, a notification email will be sent to all BM/GM users that have access to this draft post
Response
OK
Request status
success Request code
200
Number of post(s) created
"2 posts have been created."
Id(s) of post(s) created
"45,46"
Post ID and relative business ID pair list
Show child attributes
Show child attributes
[
{
"post_id": 101,
"business_id": "1234567890"
},
{
"post_id": 102,
"business_id": "1234567891"
}
]Was this page helpful?