Documentation API

InstantPost dispose d'une API REST simple. Vous pouvez créer, lire et mettre à jour des articles par programmation.

Authentification

Envoyez votre clé API dans l'en-tête HTTP : X-Api-Key: VOTRE_CLÉ

URL de base: https://instantpost.us

Créer un article

POST /api/posts

Header: X-Api-Key: YOUR_KEY   Content-Type: application/json

{
  "title":         "My title",          // optional
  "body":          "Post content...",   // required, Markdown ok
  "tags":          "php, tutorial",      // optional, comma separated
  "focus_keyword": "PHP"                 // optional, SEO
}

Response 201:

{
  "id":         "aBcDeFgHiJ",
  "url":        "https://instantpost.us/p/aBcDeFgHiJ",
  "edit_url":   "https://instantpost.us/e/YOUR_EDIT_TOKEN",
  "edit_token": "YOUR_EDIT_TOKEN"
}

cURL:

curl -X POST https://instantpost.us/api/posts \
  -H "X-Api-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Hello","body":"World","tags":"test"}'

Modifier un article

PUT /api/posts/{id}?token=EDIT_TOKEN

Or pass token as header: X-Edit-Token: EDIT_TOKEN

curl -X PUT https://instantpost.us/api/posts/aBcDeFgHiJ?token=YOUR_EDIT_TOKEN \
  -H "X-Api-Key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"body":"Updated content"}'

Récupérer un article

GET /api/posts/{id}

No authentication required.

curl https://instantpost.us/api/posts/aBcDeFgHiJ

Lister les articles

GET /api/posts?page=1&per_page=20&tag=php

No authentication required. Parameters: page, per_page (max 50), tag

curl "https://instantpost.us/api/posts?page=1&per_page=10&tag=tutorial"

Demander une clé API

InstantPost dispose d'une API REST simple. Vous pouvez créer, lire et mettre à jour des articles par programmation.

Votre clé API (affichée une seule fois — sauvegardez-la !)

Python

import requests

API_KEY = "ip_YOUR_KEY_HERE"
BASE    = "https://instantpost.us"

r = requests.post(
    f"{BASE}/api/posts",
    headers={"X-Api-Key": API_KEY},
    json={"title": "Hello from Python", "body": "It works!", "tags": "python,api"}
)
print(r.json())

PHP

<?php
$data = json_encode(["title"=>"Hello","body"=>"From PHP","tags"=>"php"]);
$ctx  = stream_context_create(["http"=>[
    "method"  => "POST",
    "header"  => "Content-Type: application/json\r\nX-Api-Key: ip_YOUR_KEY\r\n",
    "content" => $data,
]]);
$res = file_get_contents("https://instantpost.us/api/posts", false, $ctx);
var_dump(json_decode($res, true));