comments
Comments API Endpoint: Post and manage comments on a post.
❗Click the › in the endpoint to view details.
post
https://app.ayrshare.com/api
/comments
Post a Comment
cURL
Node.js
Python
PHP
Go
C#
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"id": "Ut1fWU6XkqkMayHGnJZ", "platforms": ["facebook", "instagram", "linkedin", "twitter"], "comment": "An amazing comment!"}' \
-X POST https://app.ayrshare.com/api/comments
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/comments", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${API_KEY}`
},
body: JSON.stringify({
id: "Ut1fWU6XkqkMayHGnJZ", // required
platforms: ["facebook", "instagram", "linkedin", "twitter"], // required
comment: "An amazing comment!", //required
}),
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
payload = {'id': 'Ut1fWU6XkqkMayHGnJZ',
'platforms': ['facebook', 'instagram', 'linkedin', 'twitter'],
'comment': 'An amaxing comment!'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.post('https://app.ayrshare.com/api/comments',
json=payload,
headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client(); // Use the HTTP library of your choice
$res = $client->request(
'POST',
'https://app.ayrshare.com/api/comments',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'id' => 'Ut1fWU6XkqkMayHGnJZ', // required
'platforms' => ['facebook', 'instagram', 'linkedin', 'twitter'], // required
'comment' => 'An amazing comment!', // required
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
package main
import (
"bytes"
"encoding/json"
"log"
"net/http"
)
func main() {
message := map[string]interface{}{
"id": "Ut1fWU6XkqkMayHGnJZ", // required
"platforms": []string{"facebook", "instagram", "linkedin", "twitter"}, // required
"comment": []string{"An amazing comment!"} // required
}
bytesRepresentation, err := json.Marshal(message)
if err != nil {
log.Fatalln(err)
}
req, _ := http.NewRequest("POST", "https://app.ayrshare.com/api/comments",
bytes.NewBuffer(bytesRepresentation))
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
req.Header.Add("Authorization", "Bearer API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatal("Error:", err)
}
res.Body.Close()
}
using System;
using System.Net;
using System.IO;
namespace PostPOSTRequest_charp
{
class Post
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/comments";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"id\" : \"Ut1fWU6XkqkMayHGnJZ\","
+ "\"platforms\" : [ \"facebook\", \"instagram\", \"linkedin\", \"twitter\"],"
+ "\"comment\" : [ \"An amazing comment!\" ]}";
streamWriter.Write(json);
streamWriter.Flush();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}
get
https://app.ayrshare.com/api
/comments/:id
Get Comments
cURL
Node.js
Python
PHP
C#
curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ", {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.get('https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ', headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'GET',
'https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net;
using System.IO;
namespace UserGETRequest_charp
{
class User
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}
delete
https://app.ayrshare.com/api
/comments/:id
Delete Comments
cURL
Node.js
Python
PHP
C#
curl \
-H "Authorization: Bearer API_KEY" \
-X DELETE https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ
const API_KEY = "API_KEY";
fetch("https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ", {
method: "DELETE",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
})
.then((res) => res.json())
.then((json) => console.log(json))
.catch(console.error);
import requests
headers = {'Authorization': 'Bearer API_KEY'}
r = requests.delete('https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ', headers=headers)
print(r.json())
<?php
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
$client = new GuzzleHttp\Client();
$res = $client->request(
'DELETE',
'https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;
using System.Net;
using System.IO;
namespace UserGETRequest_charp
{
class User
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
var httpResponse = (HttpWebResponse)httpWebRequest.DeleteResponse();
using (var streamReader = new StreamReader(httpResponse.DeleteResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}
Get comments or post comments for a particular user profile by adding the PROFILE_KEY in the header.
Retrieve comments for posts that did not originate via Ayrshare by providing the low-level social post ID. This ID is returned in the
postIds
field of the /post endpoint.Use the Get All Post History endpoint to retrieve posts and IDs originating outside of Ayrshare found in the
id
field.The linked account must the owner of the post to retrieve the comments. Support platforms: Facebook, Instagram, LinkedIn, TikTok, and Twitter.
Available for Business Plan users only.
GET https://app.ayrshare.com/api/comments/1yNwQOwYmNhqqQRZwvxZ?searchPlatformId=true&platform=facebook
Publish a comment to a post that was not sent via Ayrshare by using the low-level post ID. This ID is returned in the
postIds
field of the /post endpoint.Use the Get All Post History endpoint to retrieve posts and IDs originating outside of Ayrshare found in the
id
field.The linked account must the owner of the post to retrieve the comments. Support platforms: Facebook, Instagram, LinkedIn, TikTok, and Twitter.
Available for Business Plan users only.
POST https://app.ayrshare.com/api/comments
{
"id": "17945530655454295", // Required: Low-level post id return from /post or get all history
"platforms": ["instagram"], // Required: Only one social network allowed
"comment": "This is my new comment, // Required.
"searchPlatformId": true // Required.
}
Delete a comment that was not sent via Ayrshare by using the low-level
commentId
returned for a particular social network. Supported platforms: Facebook, TikTok, and Twitter.Available for Business Plan users only.
DELETE https://app.ayrshare.com/api/comments/1yNwQOwYmNhqqQRZwvxZ?searchPlatformId=true&platform=facebook
Last modified 10d ago