{"openapi":"3.0.0","info":{"title":"Polyblog API","version":"1.0.0","description":"Public REST API for Polyblog. Authenticate with an API key (HTTP Basic, the key as the username) or an operator access token. Each key carries a set of scopes that gate which resources it may read or write."},"servers":[{"url":"https://www.polyblog.io"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"basic","description":"API key as HTTP Basic credentials: Authorization: Basic base64(apiKey)"},"accessToken":{"type":"apiKey","in":"header","name":"Authorization","description":"Operator access token: Authorization: Token <token>"}}},"paths":{"/api/articles":{"get":{"tags":["Articles"],"summary":"List articles","description":"Lists the articles of a blog. Requires the `articles:read` scope. Anonymous (unauthenticated) callers only ever see published articles; drafts are visible only to an API key or operator token of the owning organization.\n","security":[{"apiKey":[]},{"accessToken":[]}],"parameters":[{"in":"query","name":"blogId","required":true,"schema":{"type":"string"}},{"in":"query","name":"locale","schema":{"type":"string"}},{"in":"query","name":"published","schema":{"type":"boolean"}},{"in":"query","name":"slug","schema":{"type":"string"}},{"in":"query","name":"limit","schema":{"type":"integer","default":0}},{"in":"query","name":"skip","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"A list of articles","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"_id":{"type":"string"},"blogId":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"content":{"type":"string"},"slug":{"type":"string"},"locale":{"type":"string"},"coverUrl":{"type":"string"},"published":{"type":"boolean"},"creationTime":{"type":"string","format":"date-time"},"lastEditTime":{"type":"string","format":"date-time"}}}}}}},"401":{"description":"Missing or invalid credentials"},"403":{"description":"API key is missing the `articles:read` scope"},"429":{"description":"API key rate limit exceeded"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://www.polyblog.io/api/articles',\n  qs: {\n    blogId: 'SOME_STRING_VALUE',\n    locale: 'SOME_STRING_VALUE',\n    published: 'SOME_BOOLEAN_VALUE',\n    slug: 'SOME_STRING_VALUE',\n    limit: 'SOME_INTEGER_VALUE',\n    skip: 'SOME_INTEGER_VALUE'\n  },\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request GET \\\n  --url 'https://www.polyblog.io/api/articles?blogId=SOME_STRING_VALUE&locale=SOME_STRING_VALUE&published=SOME_BOOLEAN_VALUE&slug=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&skip=SOME_INTEGER_VALUE' \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http GET 'https://www.polyblog.io/api/articles?blogId=SOME_STRING_VALUE&locale=SOME_STRING_VALUE&published=SOME_BOOLEAN_VALUE&slug=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&skip=SOME_INTEGER_VALUE' \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"GET\", \"/api/articles?blogId=SOME_STRING_VALUE&locale=SOME_STRING_VALUE&published=SOME_BOOLEAN_VALUE&slug=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&skip=SOME_INTEGER_VALUE\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/articles?blogId=SOME_STRING_VALUE&locale=SOME_STRING_VALUE&published=SOME_BOOLEAN_VALUE&slug=SOME_STRING_VALUE&limit=SOME_INTEGER_VALUE&skip=SOME_INTEGER_VALUE\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/articles');\n$request->setMethod(HTTP_METH_GET);\n\n$request->setQueryData([\n  'blogId' => 'SOME_STRING_VALUE',\n  'locale' => 'SOME_STRING_VALUE',\n  'published' => 'SOME_BOOLEAN_VALUE',\n  'slug' => 'SOME_STRING_VALUE',\n  'limit' => 'SOME_INTEGER_VALUE',\n  'skip' => 'SOME_INTEGER_VALUE'\n]);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/articles');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'blogId' => 'SOME_STRING_VALUE',\n  'locale' => 'SOME_STRING_VALUE',\n  'published' => 'SOME_BOOLEAN_VALUE',\n  'slug' => 'SOME_STRING_VALUE',\n  'limit' => 'SOME_INTEGER_VALUE',\n  'skip' => 'SOME_INTEGER_VALUE'\n]));\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]},"post":{"tags":["Articles"],"summary":"Create or update an article","description":"Creates an article (or updates one when the body carries an existing `_id`). Requires the `articles:write` scope. Fires the `article.created` webhook.\n","security":[{"apiKey":[]},{"accessToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"blogId":{"type":"string"},"title":{"type":"string"},"content":{"type":"string"},"slug":{"type":"string"},"locale":{"type":"string"},"published":{"type":"boolean"}}}}}},"responses":{"200":{"description":"The created or updated article"},"401":{"description":"Missing or invalid credentials"},"403":{"description":"API key is missing the `articles:write` scope"},"429":{"description":"API key rate limit exceeded"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://www.polyblog.io/api/articles',\n  headers: {'content-type': 'application/json', Authorization: 'Basic REPLACE_BASIC_AUTH'},\n  body: {\n    blogId: 'string',\n    title: 'string',\n    content: 'string',\n    slug: 'string',\n    locale: 'string',\n    published: true\n  },\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request POST \\\n  --url https://www.polyblog.io/api/articles \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH' \\\n  --header 'content-type: application/json' \\\n  --data '{\"blogId\":\"string\",\"title\":\"string\",\"content\":\"string\",\"slug\":\"string\",\"locale\":\"string\",\"published\":true}'"},{"lang":"Shell + Httpie","source":"echo '{\"blogId\":\"string\",\"title\":\"string\",\"content\":\"string\",\"slug\":\"string\",\"locale\":\"string\",\"published\":true}' |  \\\n  http POST https://www.polyblog.io/api/articles \\\n  Authorization:'Basic REPLACE_BASIC_AUTH' \\\n  content-type:application/json"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\npayload = \"{\\\"blogId\\\":\\\"string\\\",\\\"title\\\":\\\"string\\\",\\\"content\\\":\\\"string\\\",\\\"slug\\\":\\\"string\\\",\\\"locale\\\":\\\"string\\\",\\\"published\\\":true}\"\n\nheaders = {\n    'content-type': \"application/json\",\n    'Authorization': \"Basic REPLACE_BASIC_AUTH\"\n    }\n\nconn.request(\"POST\", \"/api/articles\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/articles\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => \"{\\\"blogId\\\":\\\"string\\\",\\\"title\\\":\\\"string\\\",\\\"content\\\":\\\"string\\\",\\\"slug\\\":\\\"string\\\",\\\"locale\\\":\\\"string\\\",\\\"published\\\":true}\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\",\n    \"content-type: application/json\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/articles');\n$request->setMethod(HTTP_METH_POST);\n\n$request->setHeaders([\n  'content-type' => 'application/json',\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$request->setBody('{\"blogId\":\"string\",\"title\":\"string\",\"content\":\"string\",\"slug\":\"string\",\"locale\":\"string\",\"published\":true}');\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append('{\"blogId\":\"string\",\"title\":\"string\",\"content\":\"string\",\"slug\":\"string\",\"locale\":\"string\",\"published\":true}');\n\n$request->setRequestUrl('https://www.polyblog.io/api/articles');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'content-type' => 'application/json',\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/articles/{idOrSlug}":{"get":{"tags":["Articles"],"summary":"Get an article","description":"Returns a single article by id or slug. Requires the `articles:read` scope. An article belonging to another organization responds 404 so ids cannot be probed. Anonymous callers can only read a published article; a draft responds 404 unless the caller is an API key or operator token of the owning organization.\n","security":[{"apiKey":[]},{"accessToken":[]}],"parameters":[{"in":"path","name":"idOrSlug","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The article"},"404":{"description":"Not found (or owned by another organization / unpublished)"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://www.polyblog.io/api/articles/%7BidOrSlug%7D',\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request GET \\\n  --url https://www.polyblog.io/api/articles/%7BidOrSlug%7D \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http GET https://www.polyblog.io/api/articles/%7BidOrSlug%7D \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"GET\", \"/api/articles/%7BidOrSlug%7D\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/articles/%7BidOrSlug%7D\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/articles/%7BidOrSlug%7D');\n$request->setMethod(HTTP_METH_GET);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/articles/%7BidOrSlug%7D');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/articles/generate":{"post":{"tags":["Articles"],"summary":"Generate an article with AI","description":"Generates (and by default publishes) an SEO article for a blog. Requires the `articles:write` scope. Fires the `article.created` webhook when the generated article is persisted.\n","security":[{"apiKey":[]},{"accessToken":[]}],"responses":{"200":{"description":"The generated article and metadata"},"403":{"description":"API key is missing the `articles:write` scope"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://www.polyblog.io/api/articles/generate',\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request POST \\\n  --url https://www.polyblog.io/api/articles/generate \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http POST https://www.polyblog.io/api/articles/generate \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"POST\", \"/api/articles/generate\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/articles/generate\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/articles/generate');\n$request->setMethod(HTTP_METH_POST);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/articles/generate');\n$request->setRequestMethod('POST');\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/articles/{articleId}":{"delete":{"tags":["Articles"],"summary":"Delete an article","description":"Deletes an article. Requires the `articles:write` scope. An article owned by another organization responds 404. Fires the `article.deleted` webhook.\n","security":[{"apiKey":[]},{"accessToken":[]}],"parameters":[{"in":"path","name":"articleId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The deleted article id"},"404":{"description":"Not found (or owned by another organization)"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://www.polyblog.io/api/articles/%7BarticleId%7D',\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request DELETE \\\n  --url https://www.polyblog.io/api/articles/%7BarticleId%7D \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http DELETE https://www.polyblog.io/api/articles/%7BarticleId%7D \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"DELETE\", \"/api/articles/%7BarticleId%7D\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/articles/%7BarticleId%7D\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/articles/%7BarticleId%7D');\n$request->setMethod(HTTP_METH_DELETE);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/articles/%7BarticleId%7D');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/blogs":{"get":{"tags":["Blogs"],"summary":"List blogs","description":"Lists the blogs of your organization. Requires the `blogs:read` scope.\n","security":[{"apiKey":[]},{"accessToken":[]}],"responses":{"200":{"description":"A list of blogs"},"403":{"description":"API key is missing the `blogs:read` scope"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://www.polyblog.io/api/blogs',\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request GET \\\n  --url https://www.polyblog.io/api/blogs \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http GET https://www.polyblog.io/api/blogs \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"GET\", \"/api/blogs\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/blogs\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/blogs');\n$request->setMethod(HTTP_METH_GET);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/blogs');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]},"post":{"tags":["Blogs"],"summary":"Create a blog","description":"Creates a blog for your organization. Requires the `blogs:write` scope. Fires the `blog.created` webhook.\n","security":[{"apiKey":[]},{"accessToken":[]}],"responses":{"200":{"description":"The created blog"},"403":{"description":"API key is missing the `blogs:write` scope"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://www.polyblog.io/api/blogs',\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request POST \\\n  --url https://www.polyblog.io/api/blogs \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http POST https://www.polyblog.io/api/blogs \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"POST\", \"/api/blogs\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/blogs\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/blogs');\n$request->setMethod(HTTP_METH_POST);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/blogs');\n$request->setRequestMethod('POST');\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/blogs":{"get":{"summary":"get blog details","description":"returns a blog details","parameters":[{"in":"path","name":"blogId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"blog details","content":{"application/json":{"schema":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"coverUrl":{"type":"string"},"creationTime":{"type":"string","format":"date-time"},"lastEditTime":{"type":"string","format":"date-time"},"locales":{"type":"array","items":{"type":"string"}}}}}}}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {method: 'GET', url: 'https://www.polyblog.io/blogs'};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request GET \\\n  --url https://www.polyblog.io/blogs"},{"lang":"Shell + Httpie","source":"http GET https://www.polyblog.io/blogs"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nconn.request(\"GET\", \"/blogs\")\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/blogs\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/blogs');\n$request->setMethod(HTTP_METH_GET);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/blogs');\n$request->setRequestMethod('GET');\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/blogs/{blogId}":{"put":{"tags":["Blogs"],"summary":"Update a blog","description":"Updates a blog owned by your organization. Requires the `blogs:write` scope.\n","security":[{"apiKey":[]},{"accessToken":[]}],"parameters":[{"in":"path","name":"blogId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The updated blog"},"403":{"description":"Not your organization's blog, or missing the `blogs:write` scope"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'PUT',\n  url: 'https://www.polyblog.io/api/blogs/%7BblogId%7D',\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request PUT \\\n  --url https://www.polyblog.io/api/blogs/%7BblogId%7D \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http PUT https://www.polyblog.io/api/blogs/%7BblogId%7D \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"PUT\", \"/api/blogs/%7BblogId%7D\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/blogs/%7BblogId%7D\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/blogs/%7BblogId%7D');\n$request->setMethod(HTTP_METH_PUT);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/blogs/%7BblogId%7D');\n$request->setRequestMethod('PUT');\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/topics":{"get":{"tags":["Topics"],"summary":"List topic ideas","description":"Lists the topic ideas of a blog you own. Requires the `topics:read` scope.\n","security":[{"apiKey":[]},{"accessToken":[]}],"parameters":[{"in":"query","name":"blogId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The topic ideas"},"403":{"description":"API key is missing the `topics:read` scope"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://www.polyblog.io/api/topics',\n  qs: {blogId: 'SOME_STRING_VALUE'},\n  headers: {Authorization: 'Basic REPLACE_BASIC_AUTH'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request GET \\\n  --url 'https://www.polyblog.io/api/topics?blogId=SOME_STRING_VALUE' \\\n  --header 'Authorization: Basic REPLACE_BASIC_AUTH'"},{"lang":"Shell + Httpie","source":"http GET 'https://www.polyblog.io/api/topics?blogId=SOME_STRING_VALUE' \\\n  Authorization:'Basic REPLACE_BASIC_AUTH'"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"Basic REPLACE_BASIC_AUTH\" }\n\nconn.request(\"GET\", \"/api/topics?blogId=SOME_STRING_VALUE\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/topics?blogId=SOME_STRING_VALUE\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: Basic REPLACE_BASIC_AUTH\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/topics');\n$request->setMethod(HTTP_METH_GET);\n\n$request->setQueryData([\n  'blogId' => 'SOME_STRING_VALUE'\n]);\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/topics');\n$request->setRequestMethod('GET');\n$request->setQuery(new http\\QueryString([\n  'blogId' => 'SOME_STRING_VALUE'\n]));\n\n$request->setHeaders([\n  'Authorization' => 'Basic REPLACE_BASIC_AUTH'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/webhooksubscriptions":{"get":{"tags":["Webhook subscriptions"],"summary":"List webhook subscriptions","description":"Webhook subscriptions deliver `article.created`, `article.updated`, `article.deleted`, `blog.created` and `contact.created` events to your server as signed POST requests (`X-Polyblog-Signature: t=<timestamp>,v1=<hex HMAC-SHA256 of \"timestamp.body\">`). An endpoint failing 20 times in a row is disabled automatically. Subscriptions are managed with an operator access token; the `secret` is only returned once, on create.\n","security":[{"accessToken":[]}],"responses":{"200":{"description":"Array of webhook subscriptions (without secrets)"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://www.polyblog.io/api/webhooksubscriptions',\n  headers: {Authorization: 'REPLACE_KEY_VALUE'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request GET \\\n  --url https://www.polyblog.io/api/webhooksubscriptions \\\n  --header 'Authorization: REPLACE_KEY_VALUE'"},{"lang":"Shell + Httpie","source":"http GET https://www.polyblog.io/api/webhooksubscriptions \\\n  Authorization:REPLACE_KEY_VALUE"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"REPLACE_KEY_VALUE\" }\n\nconn.request(\"GET\", \"/api/webhooksubscriptions\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/webhooksubscriptions\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"GET\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: REPLACE_KEY_VALUE\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/webhooksubscriptions');\n$request->setMethod(HTTP_METH_GET);\n\n$request->setHeaders([\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/webhooksubscriptions');\n$request->setRequestMethod('GET');\n$request->setHeaders([\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]},"post":{"tags":["Webhook subscriptions"],"summary":"Create a webhook subscription","description":"Pass a `blogId` to receive only that blog's events, or omit it for an organization-wide subscription. The response includes the signing `secret` exactly once — store it; it cannot be retrieved again.\n","security":[{"accessToken":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"blogId":{"type":"string"},"url":{"type":"string","example":"https://example.com/polyblog-webhook"},"events":{"type":"array","description":"Empty array subscribes to all events","items":{"type":"string","enum":["article.created","article.updated","article.deleted","blog.created","contact.created"]}}}}}}},"responses":{"200":{"description":"The created subscription, including its secret"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://www.polyblog.io/api/webhooksubscriptions',\n  headers: {'content-type': 'application/json', Authorization: 'REPLACE_KEY_VALUE'},\n  body: {\n    blogId: 'string',\n    url: 'https://example.com/polyblog-webhook',\n    events: ['article.created']\n  },\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request POST \\\n  --url https://www.polyblog.io/api/webhooksubscriptions \\\n  --header 'Authorization: REPLACE_KEY_VALUE' \\\n  --header 'content-type: application/json' \\\n  --data '{\"blogId\":\"string\",\"url\":\"https://example.com/polyblog-webhook\",\"events\":[\"article.created\"]}'"},{"lang":"Shell + Httpie","source":"echo '{\"blogId\":\"string\",\"url\":\"https://example.com/polyblog-webhook\",\"events\":[\"article.created\"]}' |  \\\n  http POST https://www.polyblog.io/api/webhooksubscriptions \\\n  Authorization:REPLACE_KEY_VALUE \\\n  content-type:application/json"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\npayload = \"{\\\"blogId\\\":\\\"string\\\",\\\"url\\\":\\\"https://example.com/polyblog-webhook\\\",\\\"events\\\":[\\\"article.created\\\"]}\"\n\nheaders = {\n    'content-type': \"application/json\",\n    'Authorization': \"REPLACE_KEY_VALUE\"\n    }\n\nconn.request(\"POST\", \"/api/webhooksubscriptions\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/webhooksubscriptions\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n  CURLOPT_POSTFIELDS => \"{\\\"blogId\\\":\\\"string\\\",\\\"url\\\":\\\"https://example.com/polyblog-webhook\\\",\\\"events\\\":[\\\"article.created\\\"]}\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: REPLACE_KEY_VALUE\",\n    \"content-type: application/json\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/webhooksubscriptions');\n$request->setMethod(HTTP_METH_POST);\n\n$request->setHeaders([\n  'content-type' => 'application/json',\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\n$request->setBody('{\"blogId\":\"string\",\"url\":\"https://example.com/polyblog-webhook\",\"events\":[\"article.created\"]}');\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append('{\"blogId\":\"string\",\"url\":\"https://example.com/polyblog-webhook\",\"events\":[\"article.created\"]}');\n\n$request->setRequestUrl('https://www.polyblog.io/api/webhooksubscriptions');\n$request->setRequestMethod('POST');\n$request->setBody($body);\n\n$request->setHeaders([\n  'content-type' => 'application/json',\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}},"/api/webhooksubscriptions/{webhookSubscriptionId}":{"put":{"tags":["Webhook subscriptions"],"summary":"Update a webhook subscription","description":"`url`, `events` and `active` are editable; the secret, organization and blog are immutable. Re-enabling an auto-disabled endpoint is done by setting `active` back to true.\n","security":[{"accessToken":[]}],"parameters":[{"in":"path","name":"webhookSubscriptionId","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"The updated subscription (without secret)"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'PUT',\n  url: 'https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D',\n  headers: {'content-type': 'application/json', Authorization: 'REPLACE_KEY_VALUE'},\n  body: {},\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request PUT \\\n  --url https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D \\\n  --header 'Authorization: REPLACE_KEY_VALUE' \\\n  --header 'content-type: application/json' \\\n  --data '{}'"},{"lang":"Shell + Httpie","source":"echo '{}' |  \\\n  http PUT https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D \\\n  Authorization:REPLACE_KEY_VALUE \\\n  content-type:application/json"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\npayload = \"{}\"\n\nheaders = {\n    'content-type': \"application/json\",\n    'Authorization': \"REPLACE_KEY_VALUE\"\n    }\n\nconn.request(\"PUT\", \"/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"PUT\",\n  CURLOPT_POSTFIELDS => \"{}\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: REPLACE_KEY_VALUE\",\n    \"content-type: application/json\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D');\n$request->setMethod(HTTP_METH_PUT);\n\n$request->setHeaders([\n  'content-type' => 'application/json',\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\n$request->setBody('{}');\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$body = new http\\Message\\Body;\n$body->append('{}');\n\n$request->setRequestUrl('https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D');\n$request->setRequestMethod('PUT');\n$request->setBody($body);\n\n$request->setHeaders([\n  'content-type' => 'application/json',\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]},"delete":{"tags":["Webhook subscriptions"],"summary":"Delete a webhook subscription","security":[{"accessToken":[]}],"parameters":[{"in":"path","name":"webhookSubscriptionId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Deleted"}},"x-codeSamples":[{"lang":"Node + Request","source":"const request = require('request');\n\nconst options = {\n  method: 'DELETE',\n  url: 'https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D',\n  headers: {Authorization: 'REPLACE_KEY_VALUE'}\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"},{"lang":"Shell + Curl","source":"curl --request DELETE \\\n  --url https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D \\\n  --header 'Authorization: REPLACE_KEY_VALUE'"},{"lang":"Shell + Httpie","source":"http DELETE https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D \\\n  Authorization:REPLACE_KEY_VALUE"},{"lang":"Python + Python3","source":"import http.client\n\nconn = http.client.HTTPSConnection(\"www.polyblog.io\")\n\nheaders = { 'Authorization': \"REPLACE_KEY_VALUE\" }\n\nconn.request(\"DELETE\", \"/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D\", headers=headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))"},{"lang":"Php + Curl","source":"<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, [\n  CURLOPT_URL => \"https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => \"\",\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 30,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => \"DELETE\",\n  CURLOPT_HTTPHEADER => [\n    \"Authorization: REPLACE_KEY_VALUE\"\n  ],\n]);\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}"},{"lang":"Php + Http1","source":"<?php\n\n$request = new HttpRequest();\n$request->setUrl('https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D');\n$request->setMethod(HTTP_METH_DELETE);\n\n$request->setHeaders([\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\ntry {\n  $response = $request->send();\n\n  echo $response->getBody();\n} catch (HttpException $ex) {\n  echo $ex;\n}"},{"lang":"Php + Http2","source":"<?php\n\n$client = new http\\Client;\n$request = new http\\Client\\Request;\n\n$request->setRequestUrl('https://www.polyblog.io/api/webhooksubscriptions/%7BwebhookSubscriptionId%7D');\n$request->setRequestMethod('DELETE');\n$request->setHeaders([\n  'Authorization' => 'REPLACE_KEY_VALUE'\n]);\n\n$client->enqueue($request)->send();\n$response = $client->getResponse();\n\necho $response->getBody();"}]}}},"tags":[]}