### Install Go SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for Go using go get. ```bash go get github.com/postproxy/postproxy-go ``` -------------------------------- ### Install .NET SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for .NET using dotnet add package. ```bash dotnet add package PostProxy ``` -------------------------------- ### Install Ruby SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for Ruby using gem. ```bash gem install postproxy-sdk ``` -------------------------------- ### Install PHP SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for PHP using composer. ```bash composer require postproxy/postproxy-php ``` -------------------------------- ### Install Node.js SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for Node.js using npm. ```bash npm install postproxy-sdk ``` -------------------------------- ### Create Post using Ruby SDK Source: https://postproxy.dev/getting-started/quickstart This Ruby example demonstrates creating a post with the PostProxy gem. Ensure you have the gem installed and your API key is set. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") post = client.posts.create( "Hello World!", profiles: ["facebook", "instagram"], media: ["https://example.com/image.jpg"], draft: true ) puts post ``` -------------------------------- ### Install Java SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for Java using Gradle or Maven. ```java // Gradle implementation 'dev.postproxy:postproxy-java:1.+' // Maven dev.postproxy postproxy-java 1.+ ``` -------------------------------- ### Get a Single Post using Python Source: https://postproxy.dev/getting-started/examples Fetch post details with the PostProxy Python client. This example assumes the 'postproxy' library is installed. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") post = await client.posts.get("abc123xyz") print(post) ``` -------------------------------- ### Install Python SDK Source: https://postproxy.dev/getting-started/sdks Install the PostProxy SDK for Python using pip. ```bash pip install postproxy-sdk ``` -------------------------------- ### Example API Request Source: https://postproxy.dev/getting-started/authentication Demonstrates how to make a GET request to the profiles API with the required Authorization header. ```curl curl -X GET "https://api.postproxy.dev/api/profiles" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Get a Single Post using Go Source: https://postproxy.dev/getting-started/examples Example of fetching a post using the PostProxy Go SDK. Requires the 'github.com/postproxy/postproxy-go' package. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") post, _ := client.Posts.Get(context.Background(), "abc123xyz", nil) fmt.Println(post) } ``` -------------------------------- ### Create a Post using .NET SDK Source: https://postproxy.dev/getting-started/examples This .NET example demonstrates creating a post with media using the PostProxy .NET SDK. Use the builder pattern to initialize the client. ```csharp using PostProxy; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var post = await client.Posts.CreateAsync(new CreatePostParams { Body = "Exciting news — we just launched our new feature!", Profiles = ["twitter"], Media = ["https://example.com/launch.jpg"], }); Console.WriteLine(post); ``` -------------------------------- ### Create Post using .NET SDK Source: https://postproxy.dev/getting-started/quickstart This .NET example shows how to create a post using the PostProxy SDK. It covers client initialization and calling the asynchronous create method. ```csharp using PostProxy; var client = new PostProxyClient("YOUR_API_KEY"); var post = await client.Posts.CreateAsync("Hello World!", ["facebook", "instagram"], new CreatePostOptions { Media = ["https://example.com/image.jpg"], Draft = true, }); Console.WriteLine(post); ``` -------------------------------- ### Create a Post using Node.js SDK Source: https://postproxy.dev/getting-started/examples This Node.js example demonstrates how to create a post with media using the PostProxy SDK. Initialize the client with your API key. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const post = await client.posts.create( "Exciting news — we just launched our new feature!", ["twitter"], { media: ["https://example.com/launch.jpg"] }, ); console.log(post); ``` -------------------------------- ### Create Post with Media using Go SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy Go SDK to create a post with a media file. This example requires the 'postproxy-go' package and a Go environment. ```go package main import ( "context" "fmt" "os" "path/filepath" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") path := filepath.Join(os.Getenv("HOME"), "Downloads", "Instagram post - 3.png") file, _ := os.Open(path) defer file.Close() post, _ := client.Posts.Create(context.Background(), "Check out this photo from my computer!", []string{"instagram"}, &postproxy.PostCreateOptions{ MediaFiles: []*os.File{file}, }) fmt.Println(post) } ``` -------------------------------- ### Create a Post using Go SDK Source: https://postproxy.dev/getting-started/examples This Go example shows how to create a post with media using the PostProxy Go SDK. Remember to import the necessary packages and initialize the client with your API key. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") post, _ := client.Posts.Create(context.Background(), "Exciting news — we just launched our new feature!", []string{"twitter"}, &postproxy.PostCreateOptions{ Media: []string{"https://example.com/launch.jpg"}, }) fmt.Println(post) } ``` -------------------------------- ### Create a Thread Example Source: https://postproxy.dev/getting-started/examples Example demonstrating the structure of a JSON object used to create a thread, including timestamps, platform statuses, and thread content with IDs and bodies. ```json { "created_at": "2024-01-15T10:30:00.000Z", "platforms": [ { "platform": "twitter", "status": "processing" }, { "platform": "threads", "status": "processing" } ], "thread": [ { "id": "def456", "body": "2/ First, we built the foundation..." }, { "id": "ghi789", "body": "3/ Then we added the key features..." }, { "id": "jkl012", "body": "4/ And finally, we launched! Check it out at example.com" } ] } ``` -------------------------------- ### Connection Response Example Source: https://postproxy.dev/getting-started/examples This is an example of a successful response when initializing a connection. The 'url' field contains the redirect URL for the user. ```json { "url": "https://app.postproxy.dev/partner_connect/inv789xyz", "success": true } ``` -------------------------------- ### Cross-post to Multiple Platforms using Python SDK Source: https://postproxy.dev/getting-started/examples This Python example shows how to post content to multiple platforms using the PostProxy SDK. Ensure you have the 'postproxy' package installed and replace YOUR_API_KEY. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") post = await client.posts.create( "New video is live!", ["youtube", "tiktok", "instagram"], media=["https://example.com/video.mp4"], platforms={ "youtube": {"title": "Getting Started Tutorial", "privacy_status": "public"}, "tiktok": {"format": "video", "privacy_status": "PUBLIC_TO_EVERYONE"}, "instagram": {"format": "reel", "first_comment": "Full tutorial on our channel!"}, }, ) print(post) ``` -------------------------------- ### Get Post Stats with Go SDK Source: https://postproxy.dev/getting-started/examples Retrieve post statistics using the Postproxy Go SDK. This example shows how to initialize the client and request stats for given post IDs and profiles. Ensure the 'postproxy-go' library is imported. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") stats, _ := client.Posts.Stats(context.Background(), []string{"abc123", "def456"}, &postproxy.PostStatsOptions{ Profiles: []string{"instagram", "twitter"}, }) fmt.Println(stats) } ``` -------------------------------- ### Create a Post using Java SDK Source: https://postproxy.dev/getting-started/examples This Java example shows how to create a post with media using the PostProxy Java SDK. Use the builder pattern to configure and build the client. ```java import dev.postproxy.sdk.PostProxy; import dev.postproxy.sdk.param.CreatePostParams; import java.util.List; var client = PostProxy.builder("YOUR_API_KEY").build(); var post = client.posts().create(CreatePostParams.builder() .body("Exciting news — we just launched our new feature!") .profiles(List.of("twitter")) .media(List.of("https://example.com/launch.jpg")) .build()); System.out.println(post); ``` -------------------------------- ### Get a Single Post using Java Source: https://postproxy.dev/getting-started/examples Example for retrieving a post using the PostProxy Java SDK. The 'PostProxy.builder()' method is used for client instantiation. ```java import dev.postproxy.sdk.PostProxy; var client = PostProxy.builder("YOUR_API_KEY").build(); var post = client.posts().get("abc123xyz"); System.out.println(post); ``` -------------------------------- ### Create Post using Go SDK Source: https://postproxy.dev/getting-started/quickstart Create a post using the PostProxy Go SDK. This example includes initializing the client, specifying post details, and handling potential errors. ```go package main import ( "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.New("YOUR_API_KEY") post, _ := client.Posts.Create("Hello World!", []string{"facebook", "instagram"}, &postproxy.CreatePostOptions{ Media: []string{"https://example.com/image.jpg"}, Draft: true, }) fmt.Println(post) } ``` -------------------------------- ### Get a Single Post using PHP Source: https://postproxy.dev/getting-started/examples Fetch post details using the PostProxy PHP client. This example uses the 'PostProxy\Client' class. ```php use PostProxy\Client; $client = new Client("YOUR_API_KEY"); $post = $client->posts()->get("abc123xyz"); print_r($post); ``` -------------------------------- ### Get Post Stats with .NET SDK Source: https://postproxy.dev/getting-started/examples Fetch post statistics using the Postproxy .NET SDK. This example shows how to initialize the client and request stats for given post IDs and profiles asynchronously. Ensure the PostProxy SDK is referenced in your project. ```csharp using PostProxy; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var stats = await client.Posts.StatsAsync(new PostStatsParams { PostIds = ["abc123", "def456"], Profiles = ["instagram", "twitter"], }); Console.WriteLine(stats); ``` -------------------------------- ### Create a Comment using .NET SDK Source: https://postproxy.dev/getting-started/examples This .NET example demonstrates creating a comment asynchronously using the PostProxy client. Ensure the SDK is referenced in your project. ```csharp using PostProxy; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var comment = await client.Comments.CreateAsync("POST_ID", "PROFILE_ID", "Thanks for the feedback everyone!"); Console.WriteLine(comment); ``` -------------------------------- ### Get Profiles via Go SDK Source: https://postproxy.dev/getting-started/quickstart Use the Postproxy Go SDK to get your profiles. Create a new client with your API key and call the Profiles.List() method. ```go package main import ( "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.New("YOUR_API_KEY") profiles, _ := client.Profiles.List() fmt.Println(profiles) } ``` -------------------------------- ### Create Post using Java SDK Source: https://postproxy.dev/getting-started/quickstart This Java example demonstrates creating a post using the PostProxy SDK. It includes necessary imports and method calls for creating a post with media and draft options. ```java import dev.postproxy.PostProxy; import java.util.List; PostProxy client = new PostProxy("YOUR_API_KEY"); var post = client.posts().create( "Hello World!", List.of("facebook", "instagram"), new CreatePostOptions() .media(List.of("https://example.com/image.jpg")), .draft(true) ); System.out.println(post); ``` -------------------------------- ### Create Post with Media using Ruby SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy Ruby SDK to create a post with a media file. This example requires the 'postproxy' gem and a Ruby environment. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") file_path = File.expand_path("~/Downloads/Instagram post - 3.png") post = client.posts.create( "Check out this photo from my computer!", profiles: ["instagram"], media_files: [File.open(file_path)] ) puts post ``` -------------------------------- ### Initialize Connection and Redirect (PHP) Source: https://postproxy.dev/getting-started/examples Initializes a connection for a given profile group and platform, then echoes the connection URL for user redirection. Ensure you have the PostProxy client library installed. ```php use PostProxy\Client; $client = new Client("YOUR_API_KEY"); $connection = $client->profileGroups()->initializeConnection("grp456xyz", "instagram", "https://myapp.com/oauth/callback"); // Redirect the user to $connection->url echo $connection->url; ``` -------------------------------- ### Create a multi-part thread using Go SDK Source: https://postproxy.dev/getting-started/examples This Go example demonstrates creating a multi-part thread with the PostProxy SDK. The `PostCreateOptions` struct includes a `Thread` field for defining subsequent posts and their media. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") post, _ := client.Posts.Create(context.Background(), "1/ Here is a thread about our product launch", []string{"twitter", "threads"}, &postproxy.PostCreateOptions{ Thread: []postproxy.ThreadChildInput{ {Body: "2/ First, we built the foundation..."}, {Body: "3/ Then we added the key features...", Media: []string{"https://example.com/screenshot.jpg"}}, {Body: "4/ And finally, we launched! Check it out at example.com"}, }, }) fmt.Println(post) } ``` -------------------------------- ### Create Post with Media using Python SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy Python SDK to create a post with a media file. This example requires the 'postproxy' package and a Python environment. ```python import os from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") file_path = os.path.expanduser("~/Downloads/Instagram post - 3.png") post = await client.posts.create( "Check out this photo from my computer!", ["instagram"], media_files=[open(file_path, "rb")], ) print(post) ``` -------------------------------- ### Create Post with Media using C# SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy C# SDK to create a post with a media file. This example requires the PostProxy SDK for .NET and a .NET environment. ```csharp using PostProxy; using System.IO; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads", "Instagram post - 3.png"); var post = await client.Posts.CreateAsync(new CreatePostParams { Body = "Check out this photo from my computer!", Profiles = ["instagram"], MediaFiles = [File.OpenRead(filePath)], }); Console.WriteLine(post); ``` -------------------------------- ### Create a Comment using Ruby SDK Source: https://postproxy.dev/getting-started/examples Create a comment with the PostProxy Ruby SDK. This example shows basic client initialization and comment creation. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") comment = client.comments.create("POST_ID", "Thanks for the feedback everyone!", profile_id: "PROFILE_ID") puts comment ``` -------------------------------- ### Get Profiles via Java SDK Source: https://postproxy.dev/getting-started/quickstart Use the Postproxy Java SDK to get your profiles. Instantiate the PostProxy client with your API key and call the profiles().list() method. ```java import dev.postproxy.PostProxy; PostProxy client = new PostProxy("YOUR_API_KEY"); var profiles = client.profiles().list(); System.out.println(profiles); ``` -------------------------------- ### Create Post with Media using Node.js SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy Node.js SDK to create a post with a media file. This example requires the 'postproxy-sdk' package and Node.js environment. ```javascript import PostProxy from "postproxy-sdk"; import fs from "fs"; const client = new PostProxy("YOUR_API_KEY"); const post = await client.posts.create( "Check out this photo from my computer!", ["instagram"], { mediaFiles: [ fs.createReadStream(`${process.env.HOME}/Downloads/Instagram post - 3.png`), ], }, ); console.log(post); ``` -------------------------------- ### JSON Cover Image Example (URL) Source: https://postproxy.dev/getting-started/examples Use this JSON structure when providing the cover image as a URL. Postproxy will download and store the image. ```json { "platforms": { "youtube": { "privacy_status": "public", "cover_url": "https://example.com/thumbnail.jpg" } } } ``` -------------------------------- ### Create Post with Media using Java SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy Java SDK to create a post with a media file. This example requires the PostProxy SDK for Java and a Java environment. ```java import dev.postproxy.sdk.PostProxy; import dev.postproxy.sdk.param.CreatePostParams; import java.io.File; import java.util.List; var client = PostProxy.builder("YOUR_API_KEY").build(); var filePath = System.getProperty("user.home") + "/Downloads/Instagram post - 3.png"; var post = client.posts().create(CreatePostParams.builder() .body("Check out this photo from my computer!") .profiles(List.of("instagram")) .mediaFiles(List.of(new File(filePath))) .build()); System.out.println(post); ``` -------------------------------- ### Create and Publish Draft Post (Python) Source: https://postproxy.dev/getting-started/examples Demonstrates creating a draft post and then publishing it using the PostProxy Python SDK. Ensure the SDK is installed and your API key is configured. ```python import postproxy client = postproxy.PostProxyClient("YOUR_API_KEY") # Step 1: Create a draft post = client.posts.create( "Draft content to review before posting", profiles=["instagram", "facebook"], media=["https://example.com/photo.jpg"], draft=True ) print(post) # status: "draft" # Step 2: Publish when ready published = client.posts.publish_draft(post.id) print(published) # status: "processing" ``` -------------------------------- ### Create and Publish Draft Post (PHP) Source: https://postproxy.dev/getting-started/examples Provides an example of creating a draft post and then publishing it using the PostProxy PHP client. Initialize the client with your API key. ```php use PostProxy\Client; $client = new Client("YOUR_API_KEY"); // Step 1: Create a draft $post = $client->posts()->create( "Draft content to review before posting", ["instagram", "facebook"], media: ["https://example.com/photo.jpg"], draft: true, ); print_r($post); // status: "draft" // Step 2: Publish when ready $published = $client->posts()->publishDraft($post->id); print_r($published); // status: "processing" ``` -------------------------------- ### Reply to a comment using Go Source: https://postproxy.dev/getting-started/examples This Go example shows how to reply to a comment using the postproxy-go SDK. It requires setting up the client and providing comment details including the parent ID. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") parentID := "COMMENT_ID" reply, _ := client.Comments.Create(context.Background(), "POST_ID", "PROFILE_ID", "Glad you liked it!", &postproxy.CommentCreateOptions{ParentID: &parentID}) fmt.Println(reply) } ``` -------------------------------- ### List Posts (.NET) Source: https://postproxy.dev/getting-started/examples Fetch a paginated list of your posts using the PostProxy .NET SDK. Ensure you have installed the 'PostProxy' NuGet package. ```csharp using PostProxy; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var posts = await client.Posts.ListAsync(new ListPostsParams { Page = 0, PerPage = 5, }); Console.WriteLine(posts); ``` -------------------------------- ### Create and Publish Draft Post (Ruby) Source: https://postproxy.dev/getting-started/examples Illustrates creating a draft post and then publishing it with the PostProxy Ruby gem. Ensure you have the gem installed and your API key is set. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") # Step 1: Create a draft post = client.posts.create( "Draft content to review before posting", profiles: ["instagram", "facebook"], media: ["https://example.com/photo.jpg"], draft: true ) puts post # status: "draft" # Step 2: Publish when ready published = client.posts.publish_draft(post.id) puts published # status: "processing" ``` -------------------------------- ### Create a Comment using Java SDK Source: https://postproxy.dev/getting-started/examples Example of creating a comment using the PostProxy Java SDK. This code initializes the client and calls the create method. ```java import dev.postproxy.sdk.PostProxy; var client = PostProxy.builder("YOUR_API_KEY").build(); var comment = client.comments().create("POST_ID", "PROFILE_ID", "Thanks for the feedback everyone!"); System.out.println(comment); ``` -------------------------------- ### Create Post with Media using PHP SDK Source: https://postproxy.dev/getting-started/examples Use the PostProxy PHP SDK to create a post with a media file. This example requires the PostProxy PHP package and a PHP environment. ```php posts()->create( "Check out this photo from my computer!", ["instagram"], ["media_files" => [$filePath]], ); print_r($post); ``` -------------------------------- ### Create a Post using Python SDK Source: https://postproxy.dev/getting-started/examples Use this Python snippet to create a post with media via the PostProxy SDK. Ensure the PostProxy library is installed and the client is initialized with your API key. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") post = await client.posts.create( "Exciting news — we just launched our new feature!", ["twitter"], media=["https://example.com/launch.jpg"], ) print(post) ``` -------------------------------- ### Get Profiles via .NET SDK Source: https://postproxy.dev/getting-started/quickstart Retrieve your profiles using the Postproxy .NET SDK. Initialize the PostProxyClient with your API key and call the Profiles.ListAsync() method. ```csharp using PostProxy; var client = new PostProxyClient("YOUR_API_KEY"); var profiles = await client.Profiles.ListAsync(); Console.WriteLine(profiles); ``` -------------------------------- ### Update a Post using .NET Source: https://postproxy.dev/getting-started/examples Update a post using the PostProxy .NET SDK. This example shows how to asynchronously update the body, profiles, and media of a post. ```csharp using PostProxy; using PostProxy.Parameters; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var post = await client.Posts.UpdateAsync("abc123xyz", new UpdatePostParams { Body = "Updated post content!", Profiles = ["twitter", "threads"], Media = ["https://example.com/new-image.jpg"], }); Console.WriteLine(post); ``` -------------------------------- ### Cross-post to Multiple Platforms using Go SDK Source: https://postproxy.dev/getting-started/examples This Go example demonstrates cross-posting content to multiple platforms using the PostProxy Go SDK. It includes platform-specific parameters for YouTube, TikTok, and Instagram. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") title := "Getting Started Tutorial" ytPrivacy := postproxy.YouTubePrivacy("public") ttFormat := postproxy.TikTokFormat("video") ttPrivacy := postproxy.TikTokPrivacy("PUBLIC_TO_EVERYONE") igFormat := postproxy.InstagramFormat("reel") firstComment := "Full tutorial on our channel!" post, _ := client.Posts.Create(context.Background(), "New video is live!", []string{"youtube", "tiktok", "instagram"}, &postproxy.PostCreateOptions{ Media: []string{"https://example.com/video.mp4"}, Platforms: &postproxy.PlatformParams{ YouTube: &postproxy.YouTubeParams{ Title: &title, PrivacyStatus: &ytPrivacy, }, TikTok: &postproxy.TikTokParams{ Format: &ttFormat, PrivacyStatus: &ttPrivacy, }, Instagram: &postproxy.InstagramParams{ Format: &igFormat, FirstComment: &firstComment, }, }, }) fmt.Println(post) } ``` -------------------------------- ### Get Profiles via Python SDK Source: https://postproxy.dev/getting-started/quickstart Fetch your profiles using the Postproxy Python SDK. Instantiate the client with your API key and use the profiles.list() method. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") profiles = await client.profiles.list() print(profiles) ``` -------------------------------- ### Get Post Stats with Node.js SDK Source: https://postproxy.dev/getting-started/examples Use the Postproxy Node.js SDK to fetch post statistics. This example retrieves stats for specified post IDs and profiles. Requires installation of the 'postproxy-sdk' package. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const stats = await client.posts.stats(["abc123", "def456"], { profiles: ["instagram", "twitter"], }); console.log(stats); ``` -------------------------------- ### Cross-post to Multiple Platforms using Node.js SDK Source: https://postproxy.dev/getting-started/examples This Node.js example demonstrates how to use the PostProxy SDK to post content to multiple platforms. It requires the 'postproxy-sdk' package and your API key. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const post = await client.posts.create( "New video is live!", ["youtube", "tiktok", "instagram"], { media: ["https://example.com/video.mp4"], platforms: { youtube: { title: "Getting Started Tutorial", privacy_status: "public" }, tiktok: { format: "video", privacy_status: "PUBLIC_TO_EVERYONE" }, instagram: { format: "reel", first_comment: "Full tutorial on our channel!" }, }, }, ); console.log(post); ``` -------------------------------- ### Cross-post to Multiple Platforms using Ruby SDK Source: https://postproxy.dev/getting-started/examples This Ruby example shows how to use the PostProxy gem to post content to multiple platforms simultaneously. It requires the 'postproxy' gem and your API key. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") post = client.posts.create( "New video is live!", profiles: ["youtube", "tiktok", "instagram"], media: ["https://example.com/video.mp4"], platforms: { youtube: { title: "Getting Started Tutorial", privacy_status: "public" }, tiktok: { format: "video", privacy_status: "PUBLIC_TO_EVERYONE" }, instagram: { format: "reel", first_comment: "Full tutorial on our channel!" } } ) puts post ``` -------------------------------- ### Get Profiles via Node.js SDK Source: https://postproxy.dev/getting-started/quickstart Retrieve your profiles using the Postproxy Node.js SDK. Initialize the client with your API key and call the profiles.list() method. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const profiles = await client.profiles.list(); console.log(profiles); ``` -------------------------------- ### Get Profiles via Ruby SDK Source: https://postproxy.dev/getting-started/quickstart Retrieve your profiles using the Postproxy Ruby SDK. Initialize the client with your API key and invoke the profiles.list method. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") profiles = client.profiles.list puts profiles ``` -------------------------------- ### GET /api/profiles Source: https://postproxy.dev/getting-started/authentication Example request to retrieve profiles using the Postproxy API. ```APIDOC ## GET /api/profiles ### Description Retrieves a list of profiles associated with the authenticated account or profile group. ### Method GET ### Endpoint https://api.postproxy.dev/api/profiles ### Query Parameters - **profile_group_id** (string) - Optional - The ID of the profile group to operate within. ### Request Example curl -X GET "https://api.postproxy.dev/api/profiles" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### Update a Post using Go Source: https://postproxy.dev/getting-started/examples Use the PostProxy Go SDK to update a post. This example demonstrates updating the body, profiles, and media for a given post ID. ```go package main import ( "context" "fmt" "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") ctx := context.Background() body := "Updated post content!" post, _ := client.Posts.Update(ctx, "abc123xyz", &postproxy.PostUpdateOptions{ Body: &body, Profiles: []string{"twitter", "threads"}, Media: []string{"https://example.com/new-image.jpg"}, }) fmt.Println(post) } ``` -------------------------------- ### JSON Cover Image Example (Base64) Source: https://postproxy.dev/getting-started/examples Use this JSON structure when providing the cover image as a base64 encoded string. Ensure the content type is correctly specified. ```json { "platforms": { "youtube": { "privacy_status": "public", "cover_file": { "base64": "iVBORw0KGgo...", "content_type": "image/png", "filename": "thumbnail.png" } } } } ``` -------------------------------- ### Reply to a comment using Java Source: https://postproxy.dev/getting-started/examples This Java example shows how to reply to a comment using the PostProxy SDK. It involves building the client and calling the comments create method with the necessary parameters. ```java import dev.postproxy.sdk.PostProxy; var client = PostProxy.builder("YOUR_API_KEY").build(); var reply = client.comments().create("POST_ID", "PROFILE_ID", "Glad you liked it!", "COMMENT_ID"); System.out.println(reply); ``` -------------------------------- ### Get Post Stats with Ruby SDK Source: https://postproxy.dev/getting-started/examples Use the Postproxy Ruby SDK to get post statistics. This code snippet demonstrates fetching stats for specific posts and profiles. Make sure the 'postproxy' gem is installed. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") stats = client.posts.stats( ["abc123", "def456"], profiles: ["instagram", "twitter"] ) puts stats ``` -------------------------------- ### Initialize Go SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in Go with your API key. ```go import postproxy "github.com/postproxy/postproxy-go" client := postproxy.New("YOUR_API_KEY") ``` -------------------------------- ### Get a Single Post using Node.js Source: https://postproxy.dev/getting-started/examples Retrieve a post using the PostProxy Node.js SDK. Ensure you have the 'postproxy-sdk' package installed. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const post = await client.posts.get("abc123xyz"); console.log(post); ``` -------------------------------- ### Cross-post to Multiple Platforms using PHP SDK Source: https://postproxy.dev/getting-started/examples This PHP example demonstrates how to post content to multiple platforms using the PostProxy PHP SDK. It requires your API key and specifies parameters for each platform. ```php use PostProxy\Client; $client = new Client("YOUR_API_KEY"); $post = $client->posts()->create( "New video is live!", ["youtube", "tiktok", "instagram"], media: ["https://example.com/video.mp4"], platforms: [ "youtube" => ["title" => "Getting Started Tutorial", "privacy_status" => "public"], "tiktok" => ["format" => "video", "privacy_status" => "PUBLIC_TO_EVERYONE"], "instagram" => ["format" => "reel", "first_comment" => "Full tutorial on our channel!"], ], ); print_r($post); ``` -------------------------------- ### Get a Single Post using .NET Source: https://postproxy.dev/getting-started/examples Retrieve a post using the PostProxy .NET client. This example uses the asynchronous 'GetAsync' method. ```csharp using PostProxy; var client = PostProxyClient.Builder("YOUR_API_KEY").Build(); var post = await client.Posts.GetAsync("abc123xyz"); Console.WriteLine(post); ``` -------------------------------- ### Get Profiles via PHP SDK Source: https://postproxy.dev/getting-started/quickstart Fetch your profiles using the Postproxy PHP SDK. Create a new PostProxy instance with your API key and call the profiles->list() method. ```php use PostProxy\PostProxy; $client = new PostProxy("YOUR_API_KEY"); $profiles = $client->profiles->list(); print_r($profiles); ``` -------------------------------- ### Get Post Stats with Python SDK Source: https://postproxy.dev/getting-started/examples Fetch post statistics using the Postproxy Python SDK. This snippet demonstrates how to request stats for multiple posts and profiles. Ensure the 'postproxy' library is installed. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") stats = await client.posts.stats( ["abc123", "def456"], profiles=["instagram", "twitter"], ) print(stats) ``` -------------------------------- ### Get Post Stats with PHP SDK Source: https://postproxy.dev/getting-started/examples Fetch post statistics using the Postproxy PHP SDK. This example shows how to request stats for multiple post IDs and profiles. Ensure the PostProxy client is correctly instantiated. ```php use PostProxy\Client; $client = new Client("YOUR_API_KEY"); $stats = $client->posts()->stats( ['abc123', 'def456'], profiles: ['instagram', 'twitter'], ); print_r($stats); ``` -------------------------------- ### Initialize .NET SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in .NET with your API key. ```csharp using PostProxy; var client = new PostProxyClient("YOUR_API_KEY"); ``` -------------------------------- ### Initialize PHP SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in PHP with your API key. ```php use PostProxy\PostProxy; $client = new PostProxy("YOUR_API_KEY"); ``` -------------------------------- ### Initialize Python SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in Python with your API key. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") ``` -------------------------------- ### Initialize Java SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in Java with your API key. ```java import dev.postproxy.PostProxy; PostProxy client = new PostProxy("YOUR_API_KEY"); ``` -------------------------------- ### Initialize Ruby SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in Ruby with your API key. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") ``` -------------------------------- ### Create and Publish Draft Post (Go) Source: https://postproxy.dev/getting-started/examples Shows how to create a draft post and subsequently publish it using the PostProxy Go SDK. You need to initialize the client with your API key. ```go package main import ( "context" "fmt" postproxy "github.com/postproxy/postproxy-go" ) func main() { client := postproxy.NewClient("YOUR_API_KEY") ctx := context.Background() // Step 1: Create a draft draft := true post, _ := client.Posts.Create(ctx, "Draft content to review before posting", []string{"instagram", "facebook"}, &postproxy.PostCreateOptions{ Media: []string{"https://example.com/photo.jpg"}, Draft: &draft, }) fmt.Println(post) // status: "draft" // Step 2: Publish when ready published, _ := client.Posts.PublishDraft(ctx, post.ID, nil) fmt.Println(published) // status: "processing" } ``` -------------------------------- ### Create a Post using Ruby SDK Source: https://postproxy.dev/getting-started/examples This Ruby snippet demonstrates creating a post with media using the PostProxy Ruby SDK. Initialize the client with your API key. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") post = client.posts.create( "Exciting news — we just launched our new feature!", profiles: ["twitter"], media: ["https://example.com/launch.jpg"] ) puts post ``` -------------------------------- ### API Response Example Source: https://postproxy.dev/getting-started/quickstart The JSON structure returned after successfully scheduling a post. ```json { "id": "xyz789abc", "body": "Hello World!", "status": "scheduled", "scheduled_at": "2024-01-20T12:00:00.000Z", "created_at": "2024-01-15T10:30:00.000Z", "platforms": [ { "platform": "facebook", "status": "processing", "error": null, "params": null, "attempted_at": null }, { "platform": "instagram", "status": "processing", "error": null, "params": { "format": "post" }, "attempted_at": null } ] } ``` -------------------------------- ### Get Posts with Status Filter Source: https://postproxy.dev/getting-started/post-lifecycle Retrieves a list of posts, with the ability to filter them by their current status. ```APIDOC ## GET /api/posts ### Description Retrieves a list of posts, optionally filtered by status. ### Method GET ### Endpoint /api/posts ### Query Parameters - **status** (string) - Optional - Filters posts by status. Accepted values: `draft`, `scheduled`, `published`, `failed`. ### Response #### Success Response (200) - Returns a list of post objects matching the filter criteria. #### Response Example ```json GET /api/posts?status=draft ``` ``` -------------------------------- ### Get a single post Source: https://postproxy.dev/getting-started/examples Retrieve full details for a post including media, platform results, and insights. ```APIDOC ## GET /api/posts/{postId} ### Description Retrieve full details for a post including media, platform results, and insights. ### Method GET ### Endpoint /api/posts/{postId} ### Parameters #### Path Parameters - **postId** (string) - Required - The unique identifier of the post to retrieve. ### Request Example ``` curl -X GET "https://api.postproxy.dev/api/posts/abc123xyz" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the post. - **body** (string) - The content of the post. - **status** (string) - The current status of the post (e.g., "processed", "published"). - **scheduled_at** (string) - The timestamp when the post is scheduled to be published. - **created_at** (string) - The timestamp when the post was created. - **media** (array) - A list of media objects associated with the post. - **id** (string) - The unique identifier of the media. - **status** (string) - The status of the media. - **error_message** (string) - An error message if the media processing failed. - **content_type** (string) - The MIME type of the media. - **source_url** (string) - The original URL of the media. - **url** (string) - The URL of the processed media. - **platforms** (array) - A list of platform objects detailing the post's status on each platform. - **platform** (string) - The name of the social media platform. - **status** (string) - The publishing status on the platform. - **params** (object) - Additional parameters used for publishing on the platform. - **attempted_at** (string) - The timestamp when the post was attempted to be published on the platform. - **insights** (object) - Performance insights for the post on the platform. - **impressions** (integer) - The number of impressions. - **on** (string) - The date for which the insights are recorded. #### Response Example ```json { "id": "abc123xyz", "body": "Check out our latest update!", "status": "processed", "scheduled_at": null, "created_at": "2024-01-15T10:30:00.000Z", "media": [ { "id": "med123", "status": "processed", "error_message": null, "content_type": "image/jpeg", "source_url": "https://example.com/photo.jpg", "url": "https://cdn.postproxy.dev/uploads/photo.jpg" } ], "platforms": [ { "platform": "twitter", "status": "published", "params": null, "attempted_at": "2024-01-15T10:30:01.000Z", "insights": { "impressions": 1523, "on": "2024-01-15T18:00:00.000Z" } }, { "platform": "instagram", "status": "published", "params": { "format": "post" }, "attempted_at": "2024-01-15T10:30:02.000Z", "insights": { "impressions": 3842, "on": "2024-01-15T18:00:00.000Z" } } ] } ``` ``` -------------------------------- ### Get a Single Post using cURL Source: https://postproxy.dev/getting-started/examples Use this cURL command to retrieve full details for a specific post by its ID. ```curl curl -X GET "https://api.postproxy.dev/api/posts/abc123xyz" \ -H "Authorization: Bearer YOUR_API_KEY" ``` -------------------------------- ### List Posts (PHP) Source: https://postproxy.dev/getting-started/examples Fetch a paginated list of your posts using the PostProxy PHP SDK. Ensure you have installed the 'postproxy/postproxy' package. ```php use PostProxy\Client; $client = new Client("YOUR_API_KEY"); $posts = $client->posts()->list(page: 0, perPage: 5); print_r($posts); ``` -------------------------------- ### List Posts (Ruby) Source: https://postproxy.dev/getting-started/examples Fetch a paginated list of your posts using the PostProxy Ruby gem. Ensure you have installed the 'postproxy' gem. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") posts = client.posts.list(page: 0, per_page: 5) puts posts ``` -------------------------------- ### List Posts (Python) Source: https://postproxy.dev/getting-started/examples Fetch a paginated list of your posts using the PostProxy Python SDK. Ensure you have installed the 'postproxy' package. ```python from postproxy import PostProxy client = PostProxy("YOUR_API_KEY") posts = await client.posts.list(page=0, per_page=5) print(posts) ``` -------------------------------- ### List Posts (Node.js) Source: https://postproxy.dev/getting-started/examples Fetch a paginated list of your posts using the PostProxy Node.js SDK. Ensure you have installed the 'postproxy-sdk' package. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const posts = await client.posts.list({ page: 0, perPage: 5 }); console.log(posts); ``` -------------------------------- ### Create and Publish Draft Post (Java) Source: https://postproxy.dev/getting-started/examples Demonstrates creating a draft post and then publishing it using the PostProxy Java SDK. Use the builder pattern to configure and build the client. ```java import dev.postproxy.sdk.PostProxy; import dev.postproxy.sdk.param.CreatePostParams; import java.util.List; var client = PostProxy.builder("YOUR_API_KEY").build(); // Step 1: Create a draft var post = client.posts().create(CreatePostParams.builder() .body("Draft content to review before posting") .profiles(List.of("instagram", "facebook")) .media(List.of("https://example.com/photo.jpg")) .draft(true) .build()); System.out.println(post); // status: "draft" // Step 2: Publish when ready var published = client.posts().publishDraft(post.id()); System.out.println(published); // status: "processing" ``` -------------------------------- ### Initialize Connection and Redirect (Java) Source: https://postproxy.dev/getting-started/examples Initializes a connection using the PostProxy SDK for Java and prints the connection URL. This is used to redirect users to the authorization URL. ```java import dev.postproxy.sdk.PostProxy; var client = PostProxy.builder("YOUR_API_KEY").build(); var connection = client.profileGroups().initializeConnection("grp456xyz", "instagram", "https://myapp.com/oauth/callback"); // Redirect the user to connection.url() System.out.println(connection.url()); ``` -------------------------------- ### Initialize Node.js SDK Source: https://postproxy.dev/getting-started/sdks Initialize the PostProxy client in Node.js with your API key. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); ``` -------------------------------- ### Get a Single Post using Ruby Source: https://postproxy.dev/getting-started/examples Retrieve a post using the PostProxy Ruby gem. Make sure the 'postproxy' gem is required. ```ruby require "postproxy" client = PostProxy::Client.new("YOUR_API_KEY") post = client.posts.get("abc123xyz") puts post ``` -------------------------------- ### Create a Comment using Node.js SDK Source: https://postproxy.dev/getting-started/examples Utilize the PostProxy Node.js SDK to create a comment. This method is asynchronous. Ensure you have installed the 'postproxy-sdk' package. ```javascript import PostProxy from "postproxy-sdk"; const client = new PostProxy("YOUR_API_KEY"); const comment = await client.comments.create("POST_ID", "PROFILE_ID", "Thanks for the feedback everyone!"); console.log(comment); ``` -------------------------------- ### Get profiles Source: https://postproxy.dev/getting-started/examples List all connected social media profiles in your account. This endpoint retrieves a list of all social media profiles linked to your Postproxy account. ```APIDOC ## GET /api/profiles ### Description List all connected social media profiles in your account. ### Method GET ### Endpoint /api/profiles ### Parameters #### Query Parameters None ### Request Example ``` curl -X GET "https://api.postproxy.dev/api/profiles" \ -H "Authorization: Bearer YOUR_API_KEY" ``` ### Response #### Success Response (200) - **data** (array) - A list of profile objects. - **id** (string) - The unique identifier for the profile. - **name** (string) - The name of the social media profile. - **platform** (string) - The social media platform (e.g., "facebook", "instagram"). - **status** (string) - The current status of the profile (e.g., "active"). - **profile_group_id** (string) - The ID of the profile group this profile belongs to. - **expires_at** (string or null) - The expiration date of the connection, if applicable. - **post_count** (integer) - The number of posts associated with this profile. #### Response Example ```json { "data": [ { "id": "prof123abc", "name": "My Company Page", "platform": "facebook", "status": "active", "profile_group_id": "grp456xyz", "expires_at": null, "post_count": 42 } ] } ``` ```