### Implement Programmatic Access with Python Source: https://docs.publora.com/mcp/client-setup Demonstrates how to connect to the Publora MCP server using the Python SDK. Includes examples for listing tools, retrieving connections, and executing a full workflow to schedule posts. ```bash pip install mcp httpx ``` ```python import asyncio from mcp import ClientSession from mcp.client.streamable_http import streamablehttp_client async def main(): headers = {"Authorization": "Bearer sk_YOUR_API_KEY"} async with streamablehttp_client("https://mcp.publora.com", headers=headers) as (read, write, _): async with ClientSession(read, write) as session: await session.initialize() tools = await session.list_tools() print(f"Available tools: {len(tools.tools)}") for tool in tools.tools: print(f" - {tool.name}: {tool.description}") result = await session.call_tool("list_connections", {}) print(result.content[0].text) asyncio.run(main()) ``` ```python import asyncio from datetime import datetime, timedelta from mcp import ClientSession from mcp.client.streamable_http import streamablehttp_client async def schedule_post_workflow(): headers = {"Authorization": "Bearer sk_YOUR_API_KEY"} async with streamablehttp_client("https://mcp.publora.com", headers=headers) as (read, write, _): async with ClientSession(read, write) as session: await session.initialize() connections = await session.call_tool("list_connections", {}) tomorrow = (datetime.utcnow() + timedelta(days=1)).replace( hour=9, minute=0, second=0, microsecond=0 ).isoformat() + "Z" result = await session.call_tool("create_post", { "content": "Hello from Python MCP client!", "platforms": ["linkedin-YOUR_PLATFORM_ID"], "scheduledTime": tomorrow }) print(result.content[0].text) asyncio.run(schedule_post_workflow()) ``` -------------------------------- ### Python: Complete Publora API Example Source: https://docs.publora.com/examples/python/quick-start A comprehensive example demonstrating the workflow of connecting, creating a post, and checking its status using the Publora API in Python. ```python import requests from datetime import datetime, timedelta PUBLORA_API_KEY = 'YOUR_API_KEY' BASE_URL = 'https://api.publora.com/api/v1' def main(): headers = { 'Content-Type': 'application/json', 'x-publora-key': PUBLORA_API_KEY } # 1. Get connected accounts connections_response = requests.get( f'{BASE_URL}/platform-connections', headers={'x-publora-key': PUBLORA_API_KEY} ) connections = connections_response.json()['connections'] if not connections: print('No accounts connected. Visit app.publora.com to connect.') return # 2. Get platform IDs platform_ids = [c['platformId'] for c in connections] print('Posting to:', platform_ids) # 3. Create a post post_response = requests.post( f'{BASE_URL}/create-post', headers=headers, json={ 'content': 'Testing the Publora API - works great!', 'platforms': platform_ids } ) result = post_response.json() print('Created post:', result['postGroupId']) # 4. Check status import time time.sleep(5) status_response = requests.get( f'{BASE_URL}/get-post/{result["postGroupId"]}', headers={'x-publora-key': PUBLORA_API_KEY} ) status = status_response.json() for post in status['posts']: print(f"{post['platform']}: {post['status']}") if __name__ == '__main__': main() ``` -------------------------------- ### Install Python Requests Library Source: https://docs.publora.com/examples/python/quick-start Installs the 'requests' library, which is necessary for making HTTP requests to the Publora API. ```bash pip install requests ``` -------------------------------- ### Create, Upload Media, and Schedule Post using Node.js (axios) Source: https://docs.publora.com/guides/media-uploads This Node.js example uses the axios library to interact with the Publora API. It covers the complete workflow: creating a draft post, getting an upload URL, uploading an image to S3, and finally scheduling the post. Ensure you have axios and fs modules installed. ```javascript const axios = require('axios'); const fs = require('fs'); const api = axios.create({ baseURL: 'https://api.publora.com/api/v1', headers: { 'Content-Type': 'application/json', 'x-publora-key': 'YOUR_API_KEY' } }); // Step 1: Create a draft post (no scheduledTime) const { data: postData } = await api.post('/create-post', { content: 'Check out our latest product!', platforms: ['twitter-123', 'linkedin-ABC', 'instagram-456'] // No scheduledTime = draft }); // Step 2: Get a pre-signed upload URL const { data: uploadData } = await api.post('/get-upload-url', { fileName: 'product-photo.jpg', contentType: 'image/jpeg', type: 'image', postGroupId: postData.postGroupId }); // Step 3: Upload the file directly to S3 const fileBuffer = fs.readFileSync('./product-photo.jpg'); await axios.put(uploadData.uploadUrl, fileBuffer, { headers: { 'Content-Type': 'image/jpeg' } }); console.log('Image uploaded:', uploadData.fileUrl); // Step 4: Schedule the post await api.put(`/update-post/${postData.postGroupId}`, { status: 'scheduled', scheduledTime: '2026-03-15T14:30:00.000Z' }); console.log('Post scheduled!'); ``` -------------------------------- ### Complete Publora API Workflow Example (JavaScript) Source: https://docs.publora.com/examples/javascript/quick-start Demonstrates a full workflow: connecting accounts, creating a post, and checking its status after a delay. This example function `main` handles potential errors and provides feedback if no accounts are connected. ```javascript // Full workflow: list accounts, create post, check status async function main() { // 1. Get connected accounts const connections = await getConnections(); if (connections.length === 0) { console.log('No accounts connected. Visit app.publora.com to connect.'); return; } // 2. Get platform IDs const platforms = connections.map(c => c.platformId); console.log('Posting to:', platforms); // 3. Create a post const result = await createPost( 'Testing the Publora API - works great!', platforms ); // 4. Check status after a moment setTimeout(async () => { await getPostStatus(result.postGroupId); }, 5000); } main().catch(console.error); ``` -------------------------------- ### Create a Post Example (Go) Source: https://docs.publora.com/examples/go/quick-start Shows how to create a single post using the `CreatePost` method of the Publora API client. This example schedules a post for one hour in the future and specifies the content and target platforms. It requires the `PUBLORA_API_KEY` for authentication. ```go package main import ( "fmt" "log" "os" "time" "your-project/publora" ) func main() { client := publora.NewClient(os.Getenv("PUBLORA_API_KEY")) // Schedule for 1 hour from now scheduledTime := time.Now().Add(time.Hour).UTC().Format(time.RFC3339) resp, err := client.CreatePost(&publora.CreatePostRequest{ Content: "Hello from Go! Building with Publora API.", Platforms: []string{"twitter-123456789", "linkedin-ABC123DEF"}, ScheduledTime: scheduledTime, }) if err != nil { log.Fatalf("Failed to create post: %v", err) } fmt.Printf("Post created: %s\n", resp.PostGroupID) for _, post := range resp.Posts { fmt.Printf(" - %s: %s\n", post.Platform, post.Status) } } ``` -------------------------------- ### Install Publora dependencies Source: https://docs.publora.com/examples/typescript/quick-start Installs the required TypeScript development dependencies to support the Publora API integration. ```bash npm install typescript ts-node @types/node ``` -------------------------------- ### Python Publora API Setup Source: https://docs.publora.com/examples/python/quick-start Sets up the necessary imports and constants for interacting with the Publora API, including the API key and base URL. ```python import requests from datetime import datetime, timedelta PUBLORA_API_KEY = 'YOUR_API_KEY' BASE_URL = 'https://api.publora.com/api/v1' headers = { 'Content-Type': 'application/json', 'x-publora-key': PUBLORA_API_KEY } ``` -------------------------------- ### Request Test Examples Source: https://docs.publora.com/guides/cursor-ai Examples of requests to ask for unit, integration, and mock tests alongside implementation. These prompts guide developers to ensure comprehensive test coverage. ```text "Create unit tests for the Publora service class" "Add integration tests for the create post endpoint" "Write mocks for Publora API responses" ``` -------------------------------- ### Schedule Multiple Posts Example (Go) Source: https://docs.publora.com/examples/go/quick-start Demonstrates scheduling multiple posts with varying content, platforms, and delivery times using the `CreatePost` method. This example iterates through a predefined list of posts, calculates their scheduled times based on a daily offset from a base time, and includes a small delay between requests to manage rate limits. ```go package main import ( "fmt" "log" "os" "time" "your-project/publora" ) type ScheduledPost struct { Content string Platforms []string DayOffset int } func main() { client := publora.NewClient(os.Getenv("PUBLORA_API_KEY")) posts := []ScheduledPost{ {"Monday motivation: Start strong!", []string{"twitter-123456789"}, 0}, {"Tech tip Tuesday: Version your APIs!", []string{"twitter-123456789", "linkedin-ABC123DEF"}, 1}, {"Wednesday wisdom: Ship fast, iterate faster.", []string{"twitter-123456789"}, 2}, {"Throwback Thursday: How we grew to 10K users.", []string{"linkedin-ABC123DEF"}, 3}, {"Feature Friday: Check out our new dashboard!", []string{"twitter-123456789", "linkedin-ABC123DEF"}, 4}, } baseTime := time.Now().Truncate(24 * time.Hour).Add(9 * time.Hour) // 9 AM for _, post := range posts { scheduledTime := baseTime.AddDate(0, 0, post.DayOffset).Format(time.RFC3339) resp, err := client.CreatePost(&publora.CreatePostRequest{ Content: post.Content, Platforms: post.Platforms, ScheduledTime: scheduledTime, }) if err != nil { log.Printf("Failed to schedule post: %v", err) continue } fmt.Printf("Scheduled: %s -> %s\n", post.Content[:30], resp.PostGroupID) time.Sleep(200 * time.Millisecond) // Rate limiting } } ``` -------------------------------- ### Install Publora Python Dependencies Source: https://docs.publora.com/guides/mcp-server This command installs the necessary Python packages, 'mcp' and 'httpx', required for the Publora Python client example. ```bash pip install mcp httpx ``` -------------------------------- ### POST /tools/list Source: https://docs.publora.com/mcp/client-setup Retrieves a list of all available tools provided by the Publora MCP server for the current session. ```APIDOC ## POST /tools/list ### Description Lists all tools available for the authenticated session. ### Method POST ### Endpoint https://mcp.publora.com ### Parameters #### Headers - **Authorization** (string) - Required - "Bearer sk_YOUR_API_KEY" - **mcp-session-id** (string) - Required - The session ID returned from the initialize call ### Request Body - **jsonrpc** (string) - Required - Must be "2.0" - **method** (string) - Required - Must be "tools/list" ### Request Example { "jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {} } ``` -------------------------------- ### POST /initialize Source: https://docs.publora.com/mcp/client-setup Initializes a new MCP session with the Publora server, establishing protocol versioning and client capabilities. ```APIDOC ## POST /initialize ### Description Initializes a new session with the Publora MCP server. This must be the first call to establish the connection. ### Method POST ### Endpoint https://mcp.publora.com ### Request Body - **jsonrpc** (string) - Required - Must be "2.0" - **method** (string) - Required - Must be "initialize" - **params** (object) - Required - Contains protocolVersion, capabilities, and clientInfo ### Request Example { "jsonrpc": "2.0", "id": 1, "method": "initialize", "params": { "protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": { "name": "curl-test", "version": "1.0.0" } } } ``` -------------------------------- ### Configure Environment Variables and Client Settings Source: https://docs.publora.com/mcp/client-setup Demonstrates how to store the API key in shell environment variables and reference them within an MCP client configuration file for secure authentication. ```bash export PUBLORA_API_KEY="sk_YOUR_API_KEY" ``` ```json { "mcpServers": { "publora": { "type": "http", "url": "https://mcp.publora.com", "headers": { "Authorization": "Bearer ${PUBLORA_API_KEY}" } } } } ``` -------------------------------- ### Configure Cursor for Publora MCP Source: https://docs.publora.com/mcp/client-setup Instructions for setting up Publora MCP in the Cursor AI-powered code editor. Configuration can be done on a per-project basis or globally for all projects. ```json { "mcpServers": { "publora": { "type": "http", "url": "https://mcp.publora.com", "headers": { "Authorization": "Bearer sk_YOUR_API_KEY" } } } } ``` ```json { "mcpServers": { "publora": { "type": "http", "url": "https://mcp.publora.com", "headers": { "Authorization": "Bearer sk_YOUR_API_KEY" } } } } ``` -------------------------------- ### Initialize Publora Project Source: https://docs.publora.com/examples/go/quick-start Sets up the Go module environment for the project. No external dependencies are required as it utilizes the standard net/http package. ```bash go mod init your-project ``` -------------------------------- ### Example Incorrect MCP Configuration (Missing Type) Source: https://docs.publora.com/mcp/troubleshooting An example of an incorrect MCP configuration where the 'type' field is missing for a server definition. This can lead to connection errors. ```json { "mcpServers": { "publora": { "url": "https://mcp.publora.com" } } } ``` -------------------------------- ### List Connections Example (Go) Source: https://docs.publora.com/examples/go/quick-start Demonstrates how to use the `GetConnections` method from the Publora API client to fetch a list of connected social media accounts. It requires the `PUBLORA_API_KEY` environment variable for authentication and prints the count and details of each connection. ```go package main import ( "fmt" "log" "os" "your-project/publora" ) func main() { client := publora.NewClient(os.Getenv("PUBLORA_API_KEY")) connections, err := client.GetConnections() if err != nil { log.Fatalf("Failed to get connections: %v", err) } fmt.Printf("Found %d connected accounts:\n", len(connections)) for _, conn := range connections { fmt.Printf(" - %s: %s (%s)\n", conn.Platform, conn.Username, conn.PlatformID) } } ``` -------------------------------- ### Upload Video and Create Post using JavaScript (fetch) Source: https://docs.publora.com/guides/media-uploads This JavaScript example uses the fetch API to interact with the Publora API. It demonstrates creating a draft post, obtaining a pre-signed URL for video upload, uploading the video to S3, and then scheduling the post. It requires Node.js environment for fs module. ```javascript const fs = require('fs'); const API_KEY = 'YOUR_API_KEY'; const BASE_URL = 'https://api.publora.com/api/v1'; // Step 1: Create a draft post (no scheduledTime) const postResponse = await fetch(`${BASE_URL}/create-post`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-publora-key': API_KEY }, body: JSON.stringify({ content: 'Watch our latest promo video!', platforms: ['twitter-123', 'tiktok-789', 'youtube-012'] // No scheduledTime = draft }) }); const { postGroupId } = await postResponse.json(); // Step 2: Get a pre-signed upload URL for the video const uploadUrlResponse = await fetch(`${BASE_URL}/get-upload-url`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-publora-key': API_KEY }, body: JSON.stringify({ fileName: 'promo-video.mp4', contentType: 'video/mp4', type: 'video', postGroupId: postGroupId }) }); const { uploadUrl } = await uploadUrlResponse.json(); // Step 3: Upload the video to S3 const videoBuffer = await fs.promises.readFile('./promo-video.mp4'); await fetch(uploadUrl, { method: 'PUT', headers: { 'Content-Type': 'video/mp4' }, body: videoBuffer }); console.log('Video uploaded:', postGroupId); // Step 4: Schedule the post await fetch(`${BASE_URL}/update-post/${postGroupId}`, { method: 'PUT', headers: { 'Content-Type': 'application/json', 'x-publora-key': API_KEY }, body: JSON.stringify({ status: 'scheduled', scheduledTime: '2026-03-15T16:00:00.000Z' }) }); console.log('Post scheduled!'); ``` -------------------------------- ### GET /api/v1/get-post/{id} Source: https://docs.publora.com/getting-started Retrieves the details of a specific post by its unique identifier. ```APIDOC ## GET /api/v1/get-post/{id} ### Description Retrieves detailed information about a specific post using its unique ID. ### Method GET ### Endpoint https://api.publora.com/api/v1/get-post/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the post. #### Headers - **x-publora-key** (string) - Required - Your API authentication key. ### Request Example ```bash curl https://api.publora.com/api/v1/get-post/507f1f77bcf86cd799439011 \ -H "x-publora-key: YOUR_API_KEY" ``` ### Response #### Success Response (200) - **post** (object) - The post data object containing content, metadata, and platform information. #### Response Example { "id": "507f1f77bcf86cd799439011", "content": "Example post content", "status": "published" } ``` -------------------------------- ### Setup Publora API Credentials in JavaScript Source: https://docs.publora.com/examples/javascript/quick-start Initializes constants for the Publora API key and base URL, and sets up default headers for authenticated requests. Ensure you replace 'YOUR_API_KEY' with your actual Publora API key. ```javascript const PUBLORA_API_KEY = 'YOUR_API_KEY'; const BASE_URL = 'https://api.publora.com/api/v1'; const headers = { 'Content-Type': 'application/json', 'x-publora-key': PUBLORA_API_KEY }; ``` -------------------------------- ### GET /api/v1/workspace/users Source: https://docs.publora.com/guides/workspace Retrieves a list of all managed users associated with the workspace. ```APIDOC ## GET /api/v1/workspace/users ### Description Returns a list of all managed users created under the workspace. ### Method GET ### Endpoint /api/v1/workspace/users ### Response #### Success Response (200) - **users** (array) - List of managed user objects. #### Response Example { "users": [ { "_id": "6626a1f5e4b0c91a2d3f4567", "username": "client@example.com", "displayName": "Acme Corp" } ] } ``` -------------------------------- ### GET /list-posts Source: https://docs.publora.com/guides/bulk-scheduling Retrieves a list of posts based on status, platform, and pagination settings. ```APIDOC ## GET /list-posts ### Description Retrieves existing posts including drafts, scheduled, or published content. ### Method GET ### Endpoint /list-posts ### Parameters #### Query Parameters - **status** (string) - Optional - Filter by: draft, scheduled, published, failed, partially_published. - **platform** (string) - Optional - Filter by platform ID. - **page** (number) - Optional - Page number. - **limit** (number) - Optional - Results per page. ### Response #### Success Response (200) - **posts** (array) - List of post objects. - **pagination** (object) - Pagination metadata. #### Response Example { "success": true, "posts": [], "pagination": { "page": 1, "limit": 20, "totalItems": 47 } } ``` -------------------------------- ### PHP Initialize Publora Client Source: https://docs.publora.com/examples/php/quick-start Demonstrates how to initialize the `PubloraClient` in PHP. It requires the `PUBLORA_API_KEY` environment variable and the `PubloraClient.php` file. This is the first step before making any API calls. ```php createPost([ 'content' => 'Hello from PHP! Posting with Publora API.', 'platforms' => ['twitter-123456789', 'linkedin-ABC123DEF'], ]); echo "Post created: {$response['postGroupId']}\n"; foreach ($response['posts'] as $post) { echo " - {$post['platform']}: {$post['status']}\n"; } } catch (PubloraException $e) { echo "Failed to create post: " . $e->getMessage() . "\n"; } ``` -------------------------------- ### GET /api/v1/get-post/:postGroupId Source: https://docs.publora.com/getting-started Retrieves the status of a previously created post group by its unique ID. ```APIDOC ## GET /api/v1/get-post/:postGroupId ### Description Checks the status of posts within a specific group to see if they are scheduled, published, or failed. ### Method GET ### Endpoint https://api.publora.com/api/v1/get-post/{postGroupId} ### Parameters #### Path Parameters - **postGroupId** (string) - Required - The ID returned from the create-post endpoint. ### Response #### Success Response (200) - **posts** (array) - List of posts with their respective status. #### Response Example { "posts": [ { "platform": "twitter-123456789", "status": "scheduled" } ] } ``` -------------------------------- ### GET /get-post/{postGroupID} Source: https://docs.publora.com/examples/go/quick-start Retrieves the details and status of a specific post group by its ID. ```APIDOC ## GET /get-post/{postGroupID} ### Description Fetches the current status and metadata for a specific post group. ### Method GET ### Endpoint /get-post/{postGroupID} ### Parameters #### Path Parameters - **postGroupID** (string) - Required - The unique ID of the post group. ### Response #### Success Response (200) - **postGroup** (object) - The post group details. ``` -------------------------------- ### Complete B2B Onboarding Workflow Source: https://docs.publora.com/guides/workspace This example illustrates the entire B2B onboarding process. It covers creating a managed user, generating a unique connection URL for social account authentication, verifying the connection status, and finally posting content on the user's behalf. It requires API keys and user IDs for authentication. ```javascript async function onboardClient(username, displayName) { const headers = { 'Content-Type': 'application/json', 'x-publora-key': 'YOUR_API_KEY' }; // Step 1: Create the managed user const createResponse = await fetch( 'https://api.publora.com/api/v1/workspace/users', { method: 'POST', headers, body: JSON.stringify({ username, displayName }) } ); const { user } = await createResponse.json(); console.log(`1. Created user: ${user._id} (${user.displayName})`); // Step 2: Generate a connection URL for them to auth their social accounts const connectionResponse = await fetch( `https://api.publora.com/api/v1/workspace/users/${user._id}/connection-url`, { method: 'POST', headers } ); const connectionData = await connectionResponse.json(); console.log(`2. Connection URL: ${connectionData.url}`); console.log(` Expires: ${connectionData.tokenExpiresAt}`); console.log(' Send this link to the client so they can connect their social accounts.'); // Step 3: (After user connects accounts) Check their connections // In production, you would wait for a webhook or poll periodically. const connectionsResponse = await fetch( 'https://api.publora.com/api/v1/platform-connections', { headers: { 'x-publora-key': 'YOUR_API_KEY', 'x-publora-user-id': user._id } } ); const { connections } = await connectionsResponse.json(); console.log(`3. User has ${connections.length} connected accounts.`); if (connections.length === 0) { console.log(' User has not connected any accounts yet.'); return user; } // Step 4: Post on their behalf const platforms = connections.map(c => c.platformId); const postResponse = await fetch('https://api.publora.com/api/v1/create-post', { method: 'POST', headers: { ...headers, 'x-publora-user-id': user._id }, body: JSON.stringify({ content: `Welcome to ${displayName}'s social presence, powered by our platform!`, platforms, scheduledTime: '2026-03-15T14:00:00.000Z' }) }); const post = await postResponse.json(); console.log(`4. Post scheduled for user ${user._id}: ${post.postGroupId}`); return user; } // Usage const client = await onboardClient('acme-corp', 'Acme Corp'); ``` ```python import requests def onboard_client(username, display_name): api_url = 'https://api.publora.com/api/v1' headers = { 'Content-Type': 'application/json', 'x-publora-key': 'YOUR_API_KEY' } # Step 1: Create the managed user user_response = requests.post( f'{api_url}/workspace/users', headers=headers, json={'username': username, 'displayName': display_name} ) user = user_response.json()['user'] print(f"1. Created user: {user['_id']} ({user['displayName']})") # Step 2: Generate a connection URL connection_response = requests.post( f"{api_url}/workspace/users/{user['_id']}/connection-url", headers=headers ) connection_data = connection_response.json() print(f"2. Connection URL: {connection_data['url']}") print(f" Expires: {connection_data['tokenExpiresAt']}") print(' Send this link to the client.') # Step 3: Check their connections (after they connect) user_headers = {**headers, 'x-publora-user-id': user['_id']} connections_response = requests.get( f'{api_url}/platform-connections', headers=user_headers ) connections = connections_response.json()['connections'] print(f"3. User has {len(connections)} connected accounts.") if not connections: print(' User has not connected any accounts yet.') return user # Step 4: Post on their behalf platform_ids = [c['platformId'] for c in connections] post_response = requests.post( f'{api_url}/create-post', headers=user_headers, json={ 'content': f"Welcome to {display_name}'s social presence, powered by our platform!", 'platforms': platform_ids, 'scheduledTime': '2026-03-15T14:00:00.000Z' } ) post = post_response.json() print(f"4. Post scheduled for user {user['_id']}: {post['postGroupId']}") return user # Usage client = onboard_client('acme-corp', 'Acme Corp') ``` -------------------------------- ### GET /api/v1/platform-connections Source: https://docs.publora.com/examples/no-code/zapier-integration Retrieves a list of connected social media platforms and their respective IDs required for posting. ```APIDOC ## GET /api/v1/platform-connections ### Description Fetches all social media accounts currently connected to the Publora user account, including their unique platform IDs. ### Method GET ### Endpoint https://api.publora.com/api/v1/platform-connections ### Parameters #### Headers - **x-publora-key** (string) - Required - Your unique Publora API key. ### Request Example curl https://api.publora.com/api/v1/platform-connections \ -H "x-publora-key: YOUR_API_KEY" ### Response #### Success Response (200) - **platforms** (array) - List of connected platform objects containing IDs and names. #### Response Example { "platforms": [ { "id": "twitter-123", "name": "Twitter Account" }, { "id": "linkedin-456", "name": "LinkedIn Profile" } ] } ``` -------------------------------- ### Upload Video and Create Post using Python (requests) Source: https://docs.publora.com/guides/media-uploads This Python example utilizes the requests library to interact with the Publora API. It covers creating a draft post, obtaining a pre-signed URL for video upload, uploading the video to S3, and scheduling the post. Ensure the 'requests' library is installed. ```python import requests API_URL = 'https://api.publora.com/api/v1' HEADERS = { 'Content-Type': 'application/json', 'x-publora-key': 'YOUR_API_KEY' } # Step 1: Create a draft post (no scheduledTime) post_response = requests.post( f'{API_URL}/create-post', headers=HEADERS, json={ 'content': 'Watch our latest promo video!', 'platforms': ['twitter-123', 'tiktok-789', 'youtube-012'] # No scheduledTime = draft } ) post_group_id = post_response.json()['postGroupId'] # Step 2: Get a pre-signed upload URL upload_response = requests.post( f'{API_URL}/get-upload-url', headers=HEADERS, json={ 'fileName': 'promo-video.mp4', 'contentType': 'video/mp4', 'type': 'video', 'postGroupId': post_group_id } ) upload_url = upload_response.json()['uploadUrl'] # Step 3: Upload the video to S3 with open('./promo-video.mp4', 'rb') as f: requests.put(upload_url, headers={'Content-Type': 'video/mp4'}, data=f.read()) print(f"Video uploaded: {post_group_id}") # Step 4: Schedule the post requests.put( f'{API_URL}/update-post/{post_group_id}', headers=HEADERS, json={ 'status': 'scheduled', 'scheduledTime': '2026-03-15T16:00:00.000Z' } ) print('Post scheduled!') ``` -------------------------------- ### GET /get-post/{postGroupId} Source: https://docs.publora.com/examples/javascript/quick-start Retrieves the current status of a post group across all targeted platforms. ```APIDOC ## GET /get-post/{postGroupId} ### Description Checks the publishing status of a post group. ### Method GET ### Endpoint /get-post/{postGroupId} ### Parameters #### Path Parameters - **postGroupId** (string) - Required - The ID returned during post creation. ### Response #### Success Response (200) - **posts** (array) - List of status objects for each platform. #### Response Example { "posts": [ { "platform": "twitter", "status": "published" } ] } ``` -------------------------------- ### GET /platform-connections Source: https://docs.publora.com/guides/workspace Retrieves the list of social media accounts connected by a specific managed user. ```APIDOC ## GET /api/v1/platform-connections ### Description Fetches all social media platforms connected by the user identified in the x-publora-user-id header. ### Method GET ### Endpoint /api/v1/platform-connections ### Response #### Success Response (200) - **connections** (array) - List of connected platform objects #### Response Example { "connections": [ { "platformId": "twitter_1", "name": "Twitter" } ] } ``` -------------------------------- ### GET /api/v1/platform-connections Source: https://docs.publora.com/getting-started Retrieves a list of all social media accounts currently connected to the user's Publora account. ```APIDOC ## GET /api/v1/platform-connections ### Description Fetch all connected social media platforms associated with the authenticated API key. ### Method GET ### Endpoint https://api.publora.com/api/v1/platform-connections ### Parameters #### Headers - **x-publora-key** (string) - Required - The API key generated from the Publora dashboard. ### Request Example curl https://api.publora.com/api/v1/platform-connections \ -H "x-publora-key: YOUR_API_KEY" ### Response #### Success Response (200) - **connections** (array) - List of connected platform objects. #### Response Example { "connections": [ { "platformId": "twitter-123456", "username": "@you", "displayName": "Your Name" } ] } ``` -------------------------------- ### GET /platform-connections Source: https://docs.publora.com/examples/go/quick-start Retrieves a list of all social media platforms currently connected to the user's account. ```APIDOC ## GET /platform-connections ### Description Fetches all connected social media accounts and their associated platform IDs. ### Method GET ### Endpoint /platform-connections ### Response #### Success Response (200) - **connections** (array) - List of platform connection objects containing Platform, Username, and PlatformID. #### Response Example { "connections": [ { "platform": "twitter", "username": "user1", "platformId": "twitter-123" } ] } ``` -------------------------------- ### GET /platform-connections Source: https://docs.publora.com/examples/php/quick-start Retrieves a list of all social media platforms currently connected to the user's account. ```APIDOC ## GET /platform-connections ### Description Fetches all platform connections associated with the authenticated API key. ### Method GET ### Endpoint /platform-connections ### Response #### Success Response (200) - **connections** (array) - List of connected platform objects #### Response Example { "connections": [ { "platform": "linkedin", "username": "johndoe", "platformId": "linkedin-123" } ] } ```