post
Schedule posts, auto hashtag, auto-post schedule, and more. Social Media API networks: Facebook Pages, Facebook Groups, Instagram, LinkedIn, Twitter, Pinterest, YouTube, Telegram, Reddit, & TikTok.

Post API Endpoint

โ—Click the โ€บ in the endpoint to view details.
post
https://app.ayrshare.com/api
/post
Send a Post

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 '{"post": "Today is a great day!", "platforms": ["twitter", "facebook", "fbg", "instagram", "linkedin"], "mediaUrls": ["https://images.ayrshare.com/imgs/GhostBusters.jpg"]}' \
5
-X POST https://app.ayrshare.com/api/post
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
โ€‹
4
fetch("https://app.ayrshare.com/api/post", {
5
method: "POST",
6
headers: {
7
"Content-Type": "application/json",
8
"Authorization": `Bearer ${API_KEY}`
9
},
10
body: JSON.stringify({
11
post: "Today is a great day!", // required
12
platforms: ["twitter", "facebook", "fbg", "instagram", "linkedin"], // required
13
mediaUrls: ["https://images.ayrshare.com/imgs/GhostBusters.jpg"], //optional
14
}),
15
})
16
.then((res) => res.json())
17
.then((json) => console.log(json))
18
.catch(console.error);
Copied!
1
import requests
2
โ€‹
3
payload = {'post': 'Today is a great day!',
4
'platforms': ['twitter', 'facebook', 'fbg', 'instagram', 'linkedin'],
5
'mediaUrls': ['https://images.ayrshare.com/imgs/GhostBusters.jpg']}
6
headers = {'Content-Type': 'application/json',
7
'Authorization': 'Bearer API_KEY'}
8
โ€‹
9
r = requests.post('https://app.ayrshare.com/api/post',
10
json=payload,
11
headers=headers)
12
13
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
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/post',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'post' => 'Today is a great day!', // required
15
'platforms' => ['twitter', 'facebook', 'fbg', 'instagram', 'linkedin'], // required
16
'mediaUrls' => ['https://images.ayrshare.com/imgs/GhostBusters.jpg'], // optional
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
"post": "Today is a great day!",
13
"platforms": []string{"twitter", "facebook", "fbg", "instagram", "linkedin"},
14
"mediaUrls": []string{"https://images.ayrshare.com/imgs/GhostBusters.jpg"}
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/post",
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/post";
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 = "{\"post\" : \"Today is a great day!\","
22
+ "\"platforms\" : [ \"twitter\", \"facebook\", \"fbg\", \"instagram\", \"linkedin\" ],"
23
+ "\"mediaUrls\" : [ \"https://images.ayrshare.com/imgs/GhostBusters.jpg\" ]}";
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!

Details on Specific Social Networks

Please see the details pages on each social network for examples and options.

Profile Keys

Post to on behalf of user by providing users' Profile Keys a a body parameter and the additional data in the response. Business Plan required.

Image and Video Requirements

Posting images and videos have different requirements for each network. See below for details, but don't worry. Our system verifies your post before sending, so you'll get an error response if something is wrong.
We recommend for larger video files over 50 MB create a scheduled post with the scheduleDate parameter for async processing.

Auto Hashtags

Adds the the post relevant hashtags. Takes into account real-time hashtag popularity.
autoHashtag is an object, or Boolean - see below, with the following parameters:
  • max: (optional) Integer of hashtags to add, range 1-5. Default 2.
  • position: (optional) String "auto" or "end". Auto adds the hashtags within the post or to the end. "end" adds hashtags just to the end.
Post max length 1,000 characters, else hashtags will not added.
Premium or Business Plan required.
1
{
2
"max": 3, // optional: Integer range 1-5
3
"position": "auto" // optional: String "auto" or "end"
4
}
Copied!
If you do not want to send any of the above options, pass the Boolean value trueinstead of an object.
1
"autoHashtag": true
Copied!

Auto Image Resize

Automatically resize images to fit Instagram requirements with the autoResize post parameter.
1
"autoResize": true
Copied!
The image will be resized to 1080x1080 pixels with the center focused on the region with the highest Shannon entropy.
Available on Enterprise Plans

Unsplash

Auto add Unsplash Image Parameters

The following fields are available for the unsplash body parameter:
  • Random Image: random returns a random Unsplash image.
  • Search Based Image: value String search term ; e.g. money will select a random image based on money.
  • Image IDs: value Array of Ids [ids]; e.g. ["HubtZZb2fCM"] of image https://unsplash.com/photos/HubtZZb2fCMโ€‹
1
"unsplash": "random"
2
"unsplash": "search term" // unsplash: "money"
3
"unsplash"jso: ["unsplash image ID"] // unsplash: ["HubtZZb2fCM"]
Copied!
If copying an Unsplash URL to post in mediaUrls, please be sure to copy the image address and not just the URL. Please see this example for more information.

Ads

Take your users' posts to the next level by promoting them as ads. We currently only support Twitter Promoted Tweets, but additional networks are coming soon.
1
{
2
"post": "Today is a great day!",
3
"platforms": [
4
"twitter"
5
],
6
"ads": {
7
"twitter": {
8
"campaign": "19ce55aplcy",
9
"group": "it9bm"
10
}
11
}
12
}
Copied!
Promoting a post as an add requires two parameters: campaign and group ids. When the post successfully is sent, it will be promoted as an ad in the given campaign and group.
If the campaign and group ids were preset with the PUT /ads/twitter/ids endpoint, use the createAd parameter to automatically promote the post.
1
{
2
"post": "Today is a great day!",
3
"platforms": [
4
"twitter"
5
],
6
"ads": {
7
"twitter": {
8
"createAd": true
9
}
10
}
11
}
Copied!
Please see the ads docs for more details:

Use Pre-Set Campaign and Group Ids

Preset the campaign and group ids with the /ads/twitter/ids endpoint and automatically use these ids when posting and promoting a Tweet with the createAd boolean parameter. You do not need to send the campaign or group ids.
1
{
2
"post": "Today is a great day!",
3
"platforms": [
4
"twitter"
5
],
6
"ads": {
7
"twitter": {
8
"createAd": true
9
}
10
}
11
}
Copied!

Additional Info

Line Breaks

If you want to line breaks, new lines, in a post, use the invisible line break \u2063\n.For example, This is a new\u2063\nline

Rich Text Posts

You can add rich text such as "๐“—๐“ฎ๐“ต๐“ต๐“ธ, how about a little ๐—ฏ๐—ผ๐—น๐—ฑ ๐˜๐—ฒ๐˜…๐˜ and ๐˜ช๐˜ต๐˜ข๐˜ญ๐˜ช๐˜ค๐˜ด ๐˜ต๐˜ฆ๐˜น๐˜ต and an xโ‚‚?". You can use rich text on networks such as Twitter, Facebook, and Instagram. If posting to Reddit, please use Reddit-flavored Markdown formatting.
Rich Text Post example
HTML elements are used to specify the type of rich text, which is translated into unicode. For example:
1
{
2
"post": "<var>Hello</var>, how about a little <b>bold text</b> and <i>italics text</i> and an x<sub>2</sub>?"
3
"platforms": ["twitter"]
4
}
Copied!
The follow HTML elements are supported:
HTML
Example
<b>Nice One!</b>
Nice One!
<strong>Hello, world!</strong>
Hello, world!
<em>World</em>
World
normal <i>italics <b>bold italics</b></i>
normal italics bold italics
<pre>Hello, world!</pre>
โ€‹
1
Hello, world!
Copied!
<code><b>Hello</b>, world!</code>
Hello, world!
<samp>123</samp>
๐Ÿท๐Ÿธ๐Ÿน
<var>Hello</var>
๐“—๐“ฎ๐“ต๐“ต๐“ธ
x<sub>2</sub>
xโ‚‚
x<sup>2</sup>
xยฒ
Using unicode in posts lowers the accessibility for readers. Please consider this when adding rich text.
โ€‹
get
https://app.ayrshare.com/api
/post/:id
Get a Post
Please see the /history endpoint for retrieving all posts, including post not sent via Ayrshare.

Request Example

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-X GET https://app.ayrshare.com/api/post/TBEAAqAMMJoweA9wKHUl
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
โ€‹
4
fetch("https://app.ayrshare.com/api/post/TBEAAqAMMJoweA9wKHUl", {
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/post/TBEAAqAMMJoweA9wKHUl', headers=headers)
6
7
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php';// Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
3
โ€‹
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'GET',
7
'https://app.ayrshare.com/api/history/TBEAAqAMMJoweA9wKHUl',
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 HistoryGETRequest_charp
6
{
7
class History
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/history/TBEAAqAMMJoweA9wKHUl";
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!

Get a User Profile Post

Get a post for a particular user profile by passing the profileKey parameter as a query parameter.
Available for Business Plans.
cURL example:
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-X GET https://app.ayrshare.com/api/history/9dJk82s901X?profileKey=ldfnk0s82j-Hjdkws-jksjwa8-j2jksd
Copied!
โ€‹
delete
https://app.ayrshare.com/api
/post
Delete a Post

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API Key" \
3
-H 'Content-Type: application/json' \
4
-d '{"id": "Post ID"}' \
5
-X DELETE https://app.ayrshare.com/api/post
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const id = "Post ID";
4
โ€‹
5
fetch("https://app.ayrshare.com/api/post", {
6
method: "DELETE",
7
headers: {
8
"Content-Type": "application/json",
9
"Authorization": `Bearer ${API_KEY}`
10
},
11
body: JSON.stringify({ id }),
12
})
13
.then((res) => res.json())
14
.then((json) => console.log(json))
15
.catch(console.error);
Copied!
1
import requests
2
โ€‹
3
payload = {'id': 'Post ID'}
4
headers = {'Content-Type': 'application/json',
5
'Authorization': 'Bearer API_KEY'}
6
โ€‹
7
r = requests.delete('https://app.ayrshare.com/api/post',
8
json=payload,
9
headers=headers)
10
11
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
3
โ€‹
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'DELETE',
7
'https://app.ayrshare.com/api/post',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'id' => ['7NFVK0QIXET5rCUS9tmf'] // top-level id from post request
15
]
16
]
17
);
18
โ€‹
19
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 DeletePOSTRequest_charp
6
{
7
class Delete
8
{
9
static void Main(string[] args)
10
{
11
string API_KEY = "API_KEY";
12
string url = "https://app.ayrshare.com/api/post";
13
โ€‹
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "DELETE";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
โ€‹
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"id\" : \"Post ID\"}";
22
โ€‹
23
streamWriter.Write(json);
24
streamWriter.Flush();
25
}
26
โ€‹
27
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
28
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
29
{
30
var response = streamReader.ReadToEnd();
31
Console.WriteLine(response);
32
}
33
}
34
}
35
}
Copied!
Instagram and Facebook Groups do not support delete via an API. Please go to instagram.com or facebook.com to delete the posts.

Delete User Profile Posts

Delete a post for a particular user profile by passing the profileKeys parameter as a body parameter.
Available for Business Plans.
Node.js example:
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const PROFILE_KEY = "PROFILE_KEY";
4
const id = "Post ID";
5
โ€‹
6
fetch("https://app.ayrshare.com/api/post", {
7
method: "DELETE",
8
headers: {
9
"Content-Type": "application/json",
10
"Authorization": `Bearer ${API_KEY}`
11
},
12
body: JSON.stringify({
13
profileKeys: PROFILE_KEY, // a single Profile Key passed as a String
14
id
15
}),
16
})
17
.then((res) => res.json())
18
.then((json) => console.log(json))
19
.catch(console.error);
Copied!
โ€‹
put
https://app.ayrshare.com/api
/post
Update a Post

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": "s8k2jsk0pl", "scheduleDate": "2023-07-08T12:30:00Z"}' \
5
-X PUT https://app.ayrshare.com/api/post
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
โ€‹
4
fetch("https://app.ayrshare.com/api/post", {
5
method: "PUT",
6
headers: {
7
"Content-Type": "application/json",
8
"Authorization": `Bearer ${API_KEY}`
9
},
10
body: JSON.stringify({
11
id: "s8k2jsk0pl", // required
12
scheduleDate: "2023-07-08T12:30:00Z"] // required
13
}),
14
})
15
.then((res) => res.json())
16
.then((json) => console.log(json))
17
.catch(console.error);
Copied!
1
import requests
2
โ€‹
3
payload = {'id': 's8k2jsk0pl',
4
'scheduleDate': '2023-07-08T12:30:00Z'}
5
headers = {'Content-Type': 'application/json',
6
'Authorization': 'Bearer API_KEY'}
7
โ€‹
8
r = requests.put('https://app.ayrshare.com/api/post',
9
json=payload,
10
headers=headers)
11
12
print(r.json())pyth
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
3
โ€‹
4
$client = new GuzzleHttp\Client(); // Use the HTTP library of your choice
5
$res = $client->request(
6
'PUT',
7
'https://app.ayrshare.com/api/post',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'id' => 's8k2jsk0pl', // required
15
'scheduleDate' => '2023-07-08T12:30:00Z' // required
16
]
17
]
18
);
19
โ€‹
20
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": "s8k2jsk0pl",
13
"scheduleDate": "2023-07-08T12:30:00Z"
14
}
15
โ€‹
16
bytesRepresentation, err := json.Marshal(message)
17
if err != nil {
18
log.Fatalln(err)
19
}
20
โ€‹
21
req, _ := http.NewRequest("PUT", "https://app.ayrshare.com/api/post",
22
bytes.NewBuffer(bytesRepresentation))
23
โ€‹
24
req.Header.Add("Content-Type", "application/json; charset=UTF-8")
25
req.Header.Add("Authorization", "Bearer API_KEY")
26
โ€‹
27
res, err := http.DefaultClient.Do(req)
28
if err != nil {
29
log.Fatal("Error:", err)
30
}
31
โ€‹
32
res.Body.Close()
33
}
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/post";
13
โ€‹
14
var httpWebRequest = WebRequest.CreateHttp(url);
15
httpWebRequest.ContentType = "application/json";
16
httpWebRequest.Method = "PUT";
17
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
18
โ€‹
19
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
20
{
21
string json = "{\"id\" : \"s8k2jsk0pl\","
22
+ "\"scheduleDate\" : \"2023-07-08T12:30:00Z\",";
23
โ€‹
24
streamWriter.Write(json);
25
streamWriter.Flush();
26
}
27
โ€‹
28
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
29
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
30
{
31
var response = streamReader.ReadToEnd();
32
Console.WriteLine(response);
33
}
34
}
35
}
36
}#
Copied!

Update a User Profile Post

Update a post for a particular user profile by passing the profileKey parameter as a body parameter.
Available for Business Plans.
cURL example:
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: application/json' \
4
-d '{"id": "s8k2jsk0pl", "scheduleDate": "2023-07-08T12:30:00Z", "profileKey": "6EAL0QQ-JGMMFE7-GJ1CHNQ-7L7ESA0"}' \
5
-X PUT https://app.ayrshare.com/api/post
Copied!
โ€‹
post
https://app.ayrshare.com/api
/post/bulk
Bulk Post

Request Examples

A multipart form-data containing a CSV file of posts will schedule them for a future date.
1
curl \
2
-H "Authorization: Bearer API_KEY" \
3
-H 'Content-Type: multipart/form-data' \
4
-F '[email protected]"./Ayrshare CSV Template.csv"' \
5
-X POST https://app.ayrshare.com/api/post/bulk
Copied!
The CSV file contains the following fields (template below):
  • post: The post text.
  • platforms: Comma separated list of platforms, e.g. "twitter, facebook, instagram".
  • mediaUrls: URL of media, such as an image or video to include in the post.
  • scheduleDate: Datetime to schedule the post. Format: MM/DD/YYYY h:m. E.g. 5/23/2021 14:34. Times are in UTCโˆ’08:00.
Don't send duplicate posts less than three days apart.
If the scheduleDate of two posts with the exact same text are less than three days apart, the second post will be rejected when the scheduleDate occurs. This is done to protect your account at the networks; they often suspend or shadow-ban accounts with frequent duplicate posts.

CSV Template

Download the template and save as a .csv file.
Ayrshare CSV Template.csv
188B
Text
Ayrshare CSV Template
post
https://app.ayrshare.com
/post/checkPostWeight
Check post length

Request Examples

cURL
Node.js
Python
PHP
C#
1
curl \
2
-H "Authorization: Bearer API Key" \
3
-H 'Content-Type: application/json' \
4
-d '{"post": "๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ"}' \
5
-X POST https://app.ayrshare.com/api/post/checkPostWeight
Copied!
1
const fetch = require("node-fetch");
2
const API_KEY = "API_KEY";
3
const post = "๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ";
4
โ€‹
5
fetch("https://app.ayrshare.com/api/post/checkPostWeight", {
6
method: "POST",
7
headers: {
8
"Content-Type": "application/json",
9
"Authorization": `Bearer ${API_KEY}`
10
},
11
body: JSON.stringify({ post }),
12
})
13
.then((res) => res.json())
14
.then((json) => console.log(json))
15
.catch(console.error);
Copied!
1
import requests
2
โ€‹
3
payload = {'post': '๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ'}
4
headers = {'Content-Type': 'application/json',
5
'Authorization': 'Bearer API_KEY'}
6
โ€‹
7
r = requests.post('https://app.ayrshare.com/api/post/checkPostWeight',
8
json=payload,
9
headers=headers)
10
11
print(r.json())
Copied!
1
<?php
2
require 'vendor/autoload.php'; // Composer auto-loader using Guzzle. See https://docs.guzzlephp.org/en/stable/overview.html
3
โ€‹
4
$client = new GuzzleHttp\Client();
5
$res = $client->request(
6
'POST',
7
'https://app.ayrshare.com/api/post/checkPostWeight',
8
[
9
'headers' => [
10
'Content-Type' => 'application/json',
11
'Authorization' => 'Bearer API_KEY'
12
],
13
'json' => [
14
'post' => ['๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ']
15
]
16
]
17
);
18
โ€‹
19
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 CheckPostWeightRequest_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/post/checkPostWeight";
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 = "{\"post\" : \"๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ๐Ÿฉ\"}";
22
โ€‹
23
streamWriter.Write(json);
24
streamWriter.Flush();
25
}
26
โ€‹
27
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
28
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
29
{
30
var response = streamReader.ReadToEnd();
31
Console.WriteLine(response);
32
}
33
}
34
}
35
}
Copied!
โ€‹