An easy-to-use api to schedule and publish your social media content on time, every time.
( Automate your social media posts and save time )
Try it now for free
#!/bin/bash
# Replace these variables with your actual values
API_KEY="YOUR_API_KEY"
ENDPOINT="https://api.scheduling.com/posts/create"
FILE_PATH="/path/to/your/media/file"
SCHEDULING_TIME="2025-01-05T10:00"
CAPTION="Your post caption here"
TITLE="Optional title for the post"
SELECTED_ACCOUNTS="[21]"
# Perform the API request
curl -X POST "$ENDPOINT?api_key=$API_KEY"
-H "Content-Type: multipart/form-data"
-F "files=@$FILE_PATH"
-F "scheduling_time=$SCHEDULING_TIME"
-F "caption=$CAPTION"
-F "title=$TITLE"
-F "selected_counts=$SELECTED_ACCOUNTS"
func createPost() {
url := "https://api.scheduling-api.com/posts/create?api_key=YOUR_API_KEY"
// Create a new buffer to store the multipart form data
var body bytes.Buffer
writer := multipart.NewWriter(&body)
// Add the file field (ensure the file path is correct)
filePath := "./media/sample-video.mp4"
file, err := os.Open(filePath)
if err != nil {
fmt.Println("Error opening file:", err)
return
}
defer file.Close()
part, err := writer.CreateFormFile("files", "sample-video.mp4")
if err != nil {
fmt.Println("Error creating form file:", err)
return
}
_, err = io.Copy(part, file)
if err != nil {
fmt.Println("Error copying file data:", err)
return
}
// Add other form fields
writer.WriteField("scheduling_time", "2025-01-05T10:00:00Z")
writer.WriteField("caption", "Check out my new post!")
writer.WriteField("selected_accounts", "[34,64,54]")
writer.WriteField("title", "My Scheduled Post")
err = writer.Close()
if err != nil {
fmt.Println("Error closing writer:", err)
return
}
req, err := http.NewRequest("POST", url, &body)
if err != nil {
fmt.Println("Error creating request:", err)
return
}
req.Header.Set("Content-Type", writer.FormDataContentType())
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
fmt.Println("Error making request:", err)
return
}
defer resp.Body.Close()
respBody, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading response:", err)
return
}
// Print the response
fmt.Println("Response:", string(respBody))
}
async function createPost() {
const formData = new FormData();
formData.append('files', fs.createReadStream('./media/sample-video.mp4'));
formData.append('scheduling_time', '2025-01-05T10:00');
formData.append('caption', 'Check out my new post!');
formData.append('selected_accounts', JSON.stringify([34, 64, 54]));
formData.append('title', 'My Scheduled Post');
const response = await axios.post(
'https://api.scheduling-api.com/posts?api_key=YOUR_API_KEY', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}
);
}