Fill the blog from outside
Create and update posts from another system — with one call.
One call, one post. It creates the post if it does not exist yet and updates it if it does. So you never have to remember what you already sent.
You need a program key with the task Write blog posts of a website (see Overview). The account's administration must have allowed programs — and allowed them to write.
The call
The website id is in the website's address in ModiFax. ModiFax shows you the interface's address right after creating the key.
The fields
| Field | Required | Meaning |
|---|---|---|
title | yes | The headline. At most 300 characters. |
slug | no | The natural key: the same slug updates the existing post. Without it, one is formed from the title. |
excerpt | no | The teaser in the overview. At most 1000 characters. |
body | no | The text as HTML. |
isPublished | no | true publishes, false keeps a draft. Without it: draft. |
publishedAt | no | Publication date. Without it, publishing sets the moment of the call. |
The account is not part of the call — it comes from the key. A key never finds a website of another account.
The Idempotency-Key
Every writing call needs the Idempotency-Key header — a value your system chooses for this one operation. If the same call arrives a second time with the same value, for example because your connection dropped, ModiFax answers with the first answer instead of writing twice. The same value with different contents is refused.
The answer
created tells you whether the post was created (true) or updated (false).
What happens to your HTML
The text is sanitised before it is stored. What makes an article stays: paragraphs, headings, lists, links, images, emphasis. What could be executed goes: <script>, event attributes such as onclick, embedded frames.
This is not distrust of you, but of the source behind it. HTML from outside that reaches a public page unchecked is stored cross-site scripting the moment it may carry script — and then it hits your visitors.
When something goes wrong
| Answer | Meaning | What to do |
|---|---|---|
401 KEY_REQUIRED / KEY_INVALID / KEY_REVOKED / KEY_EXPIRED | The key is missing, wrong, revoked or expired | Check the key in your profile or create a new one |
403 OPERATION_NOT_GRANTED | The key does not carry this task — or the account no longer allows writing | Tick the task when creating the key; ask the administration |
400 IDEMPOTENCY_KEY_REQUIRED | No Idempotency-Key sent | Send the header |
422 IDEMPOTENCY_KEY_REUSED | The same Idempotency-Key with different contents | Choose a value of its own for every operation |
404 | The website does not exist in this account | Check the website id |
429 TOO_MANY_REQUESTS / QUOTA_EXCEEDED | Too many calls in a short time or quota used up | Wait for Retry-After and retry |
Taking back what a program created
If a program runs off the rails, you take back what it created with one click: in your profile (or, as the administration, under Settings → Personal keys) open the key's protocol, pick a period under Take back what it created and confirm. ModiFax deletes every post the key newly created in that period — through the normal delete, with your rights and in the protocol. Posts it only updated stay.
An example worth having
A change log that writes itself: after every release your pipeline calls this endpoint with slug: "release-<version>". Because the slug is the key, a second run corrects the same entry instead of adding another — and your website keeps a version history without anyone maintaining it.