Import Markdown via the REST API
The plugin allows you to create internal Markdown documents or WordPress posts using a dedicated REST API endpoint. This enables automated publishing workflows and integration with external tools.
You can use this endpoint to integrate custom publishing systems, send content from external applications, or automate content creation pipelines based on Markdown.
Endpoint Information
Action
Create a new internal Markdown documents stored in the Documents menu or a WordPress post (in draft status).
Base route
/wp-json/ultimate-markdown-pro/v1/import
Method
POST
Parameters
- title – The title of the document or post
- content – The Markdown content
Importing Documents
To import a document:
- Configure authentication in REST API → Authentication (Create). For more details, refer to the options documentation.
- Send a POST request to:
/wp-json/ultimate-markdown-pro/v1/import
Parameters
- title (required) – The title of the document or post
- content (required) – Markdown text used to generate the document or post
- rest_api_key (required only if using API Key authentication)
Destination
You can configure where the imported content is stored:
- Documents → saves content in the internal Markdown archive
- Posts → creates WordPress posts (in draft status)
This behavior is controlled via:
Options → REST API → Processing → Destination
If Posts is selected, you can also define the Post Type where the content will be created.
JavaScript Example (Import Document)
async function importDocument() {
const endpoint = 'https://example.com/wp-json/ultimate-markdown-pro/v1/import';
const body = new URLSearchParams({
title: 'Sample Document',
content: '# Hello World\nThis is a Markdown document.',
rest_api_key: 'YOUR_API_KEY'
});
try {
const response = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: body.toString()
});
const data = await response.json();
console.log(data);
} catch (error) {
console.error('Error importing document:', error);
}
}
importDocument();
cURL Example
curl -X POST "https://example.com/wp-json/ultimate-markdown-pro/v1/import" \
-d "title=Sample Document" \
-d "content=# Hello World\nThis is a Markdown document." \
-d "rest_api_key=YOUR_API_KEY"
Response
The endpoint returns a plain text response indicating the result of the operation.
If the import operation completes successfully, the API returns:
"Data successfully added."
If an error occurs, the response will include details describing the issue. For example:
"Invalid authentication."