Developer
Hub Export API
10 min
the purple hub offers a rest api for exporting articles with all connected metadata this api provides the inverse functionality to the import api, allowing you to retrieve complete post data in the same json format used for imports api request data description example hub cluster domain determines the hub cluster, data is imported to demo purpledshub com hub identifier determines the hub instance, data is imported to my news portal authorization token securing the call to import data 1ebe0c0a 1f45 4a57 9823 40fa6afb8e02 post id wordpress post id to export 12345 the call is performed with the parameters above request get https //\<hub cluster domain>/\<hub identifier>/wp json/purple/v3/export?id= \<post id> headers authorization \<authorization token> authentication the export api uses the same jwt based authentication mechanism as the import api although token has different value response format the export api returns the same json structure as accepted by the import api, making it easy to integrate json structure the response closely follows th format of the import api post parameter json { "externalid" "\<external uuid>", "post" { "title" "\<title>", "type" "post", "date" "\<publish date, format 2023 01 01t00 00 00+01 00>", "slug" "\<slug>", "description" "\<summary/onlineteaser>", "content" "\<html content>", "structured content" "\<structured content array/>" }, "assets" \[ { "url" "\<asset url>", "caption" "\<image caption>", "acf" { "field" "value" } } ], "acf" { "overline" "\<overline>", "isins" \[ { "item" "\<isin 1>" }, { "item" "\<isin 2>" } ], "serie" "\<series>", "stadt" "\<city>" }, "featuredimage" \[ { "key" "\<key>", "value" "\<value>", "type" "string" } ], "taxonomies" { "category" \[ { "name" "\<main sections>" } ], "post tag" \[ { "name" "\<keyword 1>" }, { "name" "\<keyword 2>" } ] }, "authors" \[ "\<author 1>", "\<author 2>" ] } example response { "id" 1, "post" { "title" "comprehensive export test article", "type" "post", "date" "2023 06 15t14 30 00+00 00", "slug" "comprehensive export test article", "description" "", "content" "full post content here", "structured content" \[ { "id" "123456 1", "type" "core/heading", "parentid" "", "sequence" 0, "children" \[], "level" 0, "html" "\<h2>heading here\</h2>", "properties" \[ { "key" "level", "value" 2, "type" "integer" }, { "key" "purpleid", "value" "123456 1", "type" "string" }, { "key" "content", "value" "heading here", "type" "string" } ] }, { "id" "123456 2", "type" "core/quote", "parentid" "", "sequence" 1, "level" 0, "html" "\<blockquote class=\\"wp block quote\\">\<p>quoted text\</p>\<cite>author\</cite>\</blockquote>", "properties" \[ { "key" "content", "value" "", "type" "string" }, { "key" "purpleid", "value" "123456 2", "type" "string" }, { "key" "citation", "value" "quoted textauthor", "type" "string" } ] }, { "id" "123456 3", "type" "core/image", "parentid" "", "sequence" 2, "children" \[], "level" 0, "html" "\<figure class=\\"wp block image\\">\n \<img src=\\"https //example com/image1 png\\" alt=\\"test image\\" />\n\</figure>", "properties" \[ { "key" "id", "value" 101, "type" "integer" }, { "key" "purpleid", "value" "123456 3", "type" "string" }, { "key" "content", "value" "", "type" "string" }, { "key" "url", "value" "https //example com/image1 png", "type" "string" }, { "key" "mime type", "value" "image/png", "type" "string" }, { "key" "caption", "value" "", "type" "string" }, { "key" "original image", "value" "/uploads/image1 png", "type" "string" }, { "key" "meta img wp attached file", "value" "/uploads/image1 png", "type" "string" }, { "key" "meta img wp attachment metadata", "value" "{ }", "type" "string" } ] }, { "id" "123456 4", "type" "core/group", "parentid" "", "sequence" 3, "children" \["123456 5", "123456 6"], "level" 0, "html" "\<div class=\\"wp block group\\">\<p>inner para\</p>\<h2>inner heading\</h2>\</div>", "properties" \[ { "key" "purpleid", "value" "123456 4", "type" "string" }, { "key" "content", "value" "", "type" "string" } ] }, { "id" "123456 5", "type" "core/paragraph", "parentid" "123456 4", "sequence" 0, "children" \[], "level" 1, "html" "\<p>inner para\</p>", "properties" \[ { "key" "purpleid", "value" "123456 5", "type" "string" }, { "key" "content", "value" "inner para", "type" "string" } ] }, { "id" "123456 6", "type" "core/heading", "parentid" "123456 4", "sequence" 1, "children" \[], "level" 1, "html" "\<h2>inner heading\</h2>", "properties" \[ { "key" "purpleid", "value" "123456 6", "type" "string" }, { "key" "content", "value" "inner heading", "type" "string" }, { "key" "level", "value" 2, "type" "integer" } ] }, { "id" "123456 7", "type" "core/post featured image", "parentid" "", "sequence" 4, "children" \[], "level" 0, "html" "", "properties" \[ { "key" "purpleid", "value" "123456 7", "type" "string" }, { "key" "content", "value" "", "type" "string" }, { "key" "url", "value" "https //example com/featured png", "type" "string" }, { "key" "id", "value" 201, "type" "integer" }, { "key" "mime type", "value" "image/png", "type" "string" }, { "key" "caption", "value" "", "type" "string" }, { "key" "original image", "value" "/uploads/featured png", "type" "string" }, { "key" "meta img wp attached file", "value" "/uploads/featured png", "type" "string" }, { "key" "meta img wp attachment metadata", "value" "{ }", "type" "string" } ] }, { "id" "123456 8", "type" "core/media text", "parentid" "", "sequence" 5, "children" \[], "level" 0, "html" "\<div class=\\"wp block media text\\">\<figure>\<img src=\\"https //example com/image2 png\\" />\</figure>\<div class=\\"wp block media text content\\">\<p>some text\</p>\</div>\</div>", "properties" \[ { "key" "mediaid", "value" 301, "type" "integer" }, { "key" "mediatype", "value" "image", "type" "string" }, { "key" "purpleid", "value" "123456 8", "type" "string" }, { "key" "content", "value" "some text", "type" "string" }, { "key" "id", "value" 301, "type" "integer" }, { "key" "mime type", "value" "image/png", "type" "string" }, { "key" "caption", "value" "", "type" "string" }, { "key" "original image", "value" "/uploads/image2 png", "type" "string" }, { "key" "meta img wp attached file", "value" "/uploads/image2 png", "type" "string" }, { "key" "meta img wp attachment metadata", "value" "{ }", "type" "string" } ] }, { "id" "123456 9", "type" "core/cover", "parentid" "", "sequence" 6, "children" \[], "level" 0, "html" "\<div class=\\"wp block cover\\">\<span aria hidden=\\"true\\" class=\\"wp block cover background has background dim\\">\</span>\n\<img class=\\"wp block cover image background\\" alt=\\"\\" src=\\"https //example com/image3 png\\" data object fit=\\"cover\\" />\n\<div class=\\"wp block cover inner container\\">\<p>cover content\</p>\</div>\</div>", "properties" \[ { "key" "url", "value" "https //example com/image3 png", "type" "string" }, { "key" "id", "value" 401, "type" "integer" }, { "key" "purpleid", "value" "123456 9", "type" "string" }, { "key" "content", "value" "cover content", "type" "string" }, { "key" "mime type", "value" "image/png", "type" "string" }, { "key" "caption", "value" "", "type" "string" }, { "key" "original image", "value" "/uploads/image3 png", "type" "string" }, { "key" "meta img wp attached file", "value" "/uploads/image3 png", "type" "string" }, { "key" "meta img wp attachment metadata", "value" "{ }", "type" "string" } ] } ] }, "acf" \[ { "custom field" "10" }, { "custom field2" "13" } ], "taxonomies" { "category" \[{ "name" "customcat" }], "post tag" \[{ "name" "tag1" }, { "name" "tag2" }] }, "featuredimage" \[ { "key" "url", "value" "https //example com/featured png", "type" "string" }, { "key" "id", "value" 201, "type" "integer" }, { "key" "mime type", "value" "image/png", "type" "string" }, { "key" "caption", "value" "", "type" "string" }, { "key" "original image", "value" "/uploads/featured png", "type" "string" }, { "key" "meta img wp attached file", "value" "/uploads/featured png", "type" "string" }, { "key" "meta img wp attachment metadata", "value" "{ }", "type" "string" } ], "authors" \["test author 1", "test author 2"], "assets" \[ "https //example com/image1 png", "https //example com/featured png", "https //example com/image2 png", "https //example com/image3 png" ] } response codes and messages successful response 200 post data exported successfully error responses 400 post id is required 401 no authorization token was provided 401 the authorization token is incorrect 404 post not found with the given id 500 an unexpected error occurred while exporting post data content structure html content the actual content structure reflects the code view of the article in the purple hub, including all gutenberg blocks and custom formatting structured content the content as an array of objects where each block in editor is separate objects in response assets and media all referenced assets (images, documents, etc ) are included with their full urls and metadata url direct link to the asset caption image caption if set acf fields any custom fields associated with the asset taxonomies all taxonomies (categories, tags, custom taxonomies) are exported with their complete metadata, allowing for accurate re import on destination systems authors author information is exported as an array of author names as they appear in the source system acf data acf fields is exported as an array of data as it appears in the source system use cases the export api is designed for data migration moving content between hub instances backup solutions creating complete backups of post data third party integrations exporting data for external systems like print workflows al processing providing structured content data for ai/ml applications content syndication distributing content to partner systems security considerations all api calls require valid authentication tokens tokens should be transmitted over https only the same security mechanisms as the import api are applied integration notes the export api output is mostly compatible with the import api input format no data transformation is needed when moving content between purple hub instances the externalid from exports can be used for subsequent import operations all wordpress post metadata, acf fields, and custom taxonomies are preserved