comments
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

Request Examples

cURL
Node.js
Python
PHP
Go
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"id": "Ut1fWU6XkqkMayHGnJZ", "platforms": ["facebook", "instagram"], "comment": "An amazing comment!"}' \
5
-X POST https://app.ayrshare.com/api/comments
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
​
4
fetch("https://app.ayrshare.com/api/comments", {
5
method: "POST",
6
headers: {
7
"Content-Type": "application/json",
8
"Authorization": `Bearer ${API_KEY}`
9
},
10
body: JSON.stringify({
11
id: "Ut1fWU6XkqkMayHGnJZ", // required
12
platforms: ["facebook", "instagram"], // required
13
comment: "An amazing comment!", //required
14
}),
15
})
16
.then((res) => res.json())
17
.then((json) => console.log(json))
18
.catch(console.error);
Copied!
1
import requests
2
​
3
payload = {'id': 'Ut1fWU6XkqkMayHGnJZ',
4
'platforms': ['facebook', 'instagram'],
5
'comment': 'An amaxing comment!'}
6
headers = {'Content-Type': 'application/json',
7
'Authorization': 'Bearer API_KEY'}
8
​
9
r = requests.post('https://app.ayrshare.com/api/comments',
10
json=payload,
11
headers=headers)
12
13
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client(); // Use the HTTP library of your choice
5
$res = $client->request(
6
'POST',
7
'https://app.ayrshare.com/api/comments',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'id' => 'Ut1fWU6XkqkMayHGnJZ', // required
15
'platforms' => ['facebook', 'instagram'], // required
16
'comment' => 'An amazing comment!', // required
17
]
18
]
19
);
20
​
21
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
package main
2
​
3
import (
4
"bytes"
5
"encoding/json"
6
"log"
7
"net/http"
8
)
9
​
10
func main() {
11
message := map[string]interface{}{
12
"id": "Ut1fWU6XkqkMayHGnJZ", // required
13
"platforms": []string{"facebook", "instagram"}, // required
14
"comment": []string{"An amazing comment!"} // required
15
}
16
​
17
bytesRepresentation, err := json.Marshal(message)
18
if err != nil {
19
log.Fatalln(err)
20
}
21
​
22
req, _ := http.NewRequest("POST", "https://app.ayrshare.com/api/comments",
23
bytes.NewBuffer(bytesRepresentation))
24
​
25
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
26
req.Header.Add("Authorization", "Bearer API_KEY")
27
​
28
res, err := http.DefaultClient.Do(req)
29
if err != nil {
30
log.Fatal("Error:", err)
31
}
32
​
33
res.Body.Close()
34
}
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace PostPOSTRequest_charp
6
{
7
class Post
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/comments";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "POST";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
​
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"id\" : \"Ut1fWU6XkqkMayHGnJZ\","
22
+ "\"platforms\" : [ \"facebook\", \"instagram\"],"
23
+ "\"comment\" : [ \"An amazing comment!\" ]}";
24
​
25
streamWriter.Write(json);
26
streamWriter.Flush();
27
}
28
​
29
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
30
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
31
{
32
var response = streamReader.ReadToEnd();
33
Console.WriteLine(response);
34
}
35
}
36
}
37
}
Copied!
​
get
https://app.ayrshare.com/api
/comments
Get Comments

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-X GET https://app.ayrshare.com/api/comments?id=Ut1fWU6XkqkMayHGnJZ
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
​
4
fetch("https://app.ayrshare.com/api/comments?id=Ut1fWU6XkqkMayHGnJZ", {
5
method: "GET",
6
headers: {
7
"Authorization": `Bearer ${API_KEY}`
8
}
9
})
10
.then((res) => res.json())
11
.then((json) => console.log(json))
12
.catch(console.error);
Copied!
1
import requests
2
​
3
headers = {'Authorization': 'Bearer API_KEY'}
4
​
5
r = requests.get('https://app.ayrshare.com/api/comments?id=Ut1fWU6XkqkMayHGnJZ', headers=headers)
6
7
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader
3
​
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'GET',
7
'https://app.ayrshare.com/api/comments?id=Ut1fWU6XkqkMayHGnJZ',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
]
13
]
14
);
15
​
16
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
Copied!
1
using System;
2
using System.Net;
3
using System.IO;
4
​
5
namespace UserGETRequest_charp
6
{
7
class User
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/comments?id=Ut1fWU6XkqkMayHGnJZ";
13
​
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
17
​
18
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
19
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
20
{
21
var response = streamReader.ReadToEnd();
22
Console.WriteLine(response);
23
}
24
}
25
}
26
}
Copied!

Profiles

Get comments or post comments for a particular user profile by passing the profileKey parameter as a path parameter for GET and a body parameter for POST.

GET Path Parameter

1
https://app.ayrshare.com/api/comments?id=Ut1fWU6XkqkMayHGnJZ&profileKey=JkLs-odKJD-dQPSD-0XJD1
Copied!

POST Body Parameter

1
{
2
profileKey: "JkLs-odKJD-dQPSD-0XJD1"
3
}
Copied!
Last modified 12d ago