Open2b versione 7.5

blog-posts

blog-posts.find

Returns all the blog posts.

Request

Admin SDK
Admin.api('site.blog-posts.find', request, function(response) { … });
HTTP POST
/api/v10/site.blog-posts.find
{
  "conditions" : { // returns only the blog posts …
    "ids" : [ 12, 71, … ], // … with these identifiers - int(1…)
    "tag": 3, // … with this tag - int(1…)
    "isPublished" : true, // … that are published or not published - bool
    "after" : 22 // … with identifier after this - int(0…)
  },
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "author", "title", … ], // fields to return - string
  "order" : [ "title" ], // sort order of returned blog posts, can contain "id", "-id", "title", "-title", "creationTime" and "-creationTime", "updateTime", "-updateTime", "publicationTime", "-publicationTime" - string
  "limit" : 10, // maximum number of blog posts to return - int(1…)
  "first" : 30 // index of the first blog post to return - int(0…)
}

Response

{
  "status" : "ok",
  "posts" : [ {
    "id" : 71, // identifier - int(1…)
    "author" : "Mark", // author - string(0…50)
    "title" : { // title - string(2) -> string(0…120)
      "en" : "",
      "it" : "",
      …
    },
    "summary" : { // summary as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "content" : { // content as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "tags": [ 2, 4, … ], // tags - int(1..)
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "canonicalURL" : { // canonical URL - string(2) -> string(10…)
      "en" : "https://…",
      "it" : "https://…",
      …
    },
    "originalImage" : { // original image (can be null)
      "url" : "https://…", // url - string()
      "width" : 350, // width in pixels - int(1…)
      "height" : 200 // height in pixels - int(1…)
    },
    "smallImage" : { // small image (can be null)
      "url" : {
        "single" : "https://…", // url - string(10…)
        "double" : "https://…" // double resolution url (can be null) - string(10…)
      },
      "width" : 500, // width in pixels - int(1…)
      "height" : 400 // height in pixels - int(1…)
    },
    "largeImage" : { // large image (can be null)
      "url" : {
        "single" : "https://…", // url - string(10…)
        "double" : "https://…" // double resolution url (can be null) - string(10…)
      },
      "width" : 1000, // width in pixels - int(1…)
      "height" : 800 // height in pixels - int(1…)
    },
    "imageCaption" : { // image caption - string(0…60)
      "en" : "…",
      "it" : "…",
      …
    },
    "isPublished" : true, // indicates if the post is published - bool
    "creationTime" : "2020-03-12 09:12:36", // creation time - datetime
    "updateTime" : "2020-03-15 12:23:05", // creation time - datetime
    "publicationTime" : "2020-03-13 18:12:44" // publication time - datetime
  }, … ]
}

blog-posts.get

Returns a blog post given its identifier.

Request

Admin SDK
Admin.api('site.blog-posts.get', request, function(response) { … });
HTTP POST
/api/v10/site.blog-posts.get
{
  "id" : 71, // identifier of the blog post (required) - int(1…)
  "language" : "en", // language ( ISO code ) of the texts to return - string(2)
  "fields" : [ "id", "author", "title", … ] // fields to return - string
}

Response

{
  "status" : "ok",
  "post" : { // (can be null)
    "id" : 71, // identifier - int(1…)
    "author" : "Mark", // author - string(0…50)
    "title" : { // title - string(2) -> string(0…120)
      "en" : "",
      "it" : "",
      …
    },
    "summary" : { // summary as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "content" : { // content as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "tags": [ 2, 4, … ], // tags - int(1..)
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "canonicalURL" : { // canonical URL - string(2) -> string(10…)
      "en" : "https://…",
      "it" : "https://…",
      …
    },
    "originalImage" : { // original image (can be null)
      "url" : "https://…", // url - string()
      "width" : 350, // width in pixels - int(1…)
      "height" : 200 // height in pixels - int(1…)
    },
    "smallImage" : { // small image (can be null)
      "url" : {
        "single" : "https://…", // url - string(10…)
        "double" : "https://…" // double resolution url (can be null) - string(10…)
      },
      "width" : 500, // width in pixels - int(1…)
      "height" : 400 // height in pixels - int(1…)
    },
    "largeImage" : { // large image (can be null)
      "url" : {
        "single" : "https://…", // url - string(10…)
        "double" : "https://…" // double resolution url (can be null) - string(10…)
      },
      "width" : 1000, // width in pixels - int(1…)
      "height" : 800 // height in pixels - int(1…)
    },
    "imageCaption" : { // image caption - string(0…60)
      "en" : "…",
      "it" : "…",
      …
    },
    "isPublished" : true, // indicates if the post is published - bool
    "creationTime" : "2020-03-12 09:12:36", // creation time - datetime
    "updateTime" : "2020-03-15 12:23:05", // creation time - datetime
    "publicationTime" : "2020-03-13 18:12:44" // publication time - datetime
  }
}

blog-posts.count

Total number of blog posts.

Request

Admin SDK
Admin.api('site.blog-posts.count', null, function(response) { … });
HTTP POST
/api/v10/site.blog-posts.count
{
  "conditions" : { // returns only the blog posts …
    "ids" : [ 12, 71, … ], // … with these identifiers - int(1…)
    "tag": 3, // … with this tag - int(1…)
    "isPublished" : true, // … that are published or not published - bool
    "after" : 22 // … with identifier after this - int(0…)
}

Response

{
  "status" : "ok",
  "count" : 83 // number of blog posts - int(0…)
}

blog-posts.create

Creates a new blog post.

Request

Admin SDK
Admin.api('site.blog-posts.create', request, function(response) { … });
HTTP POST
/api/v10/site.blog-posts.create
{
  "post" : { // blog post to create (required) 
    "author" : "Mark", // author - string(0…50)
    "title" : { // title - string(2) -> string(0…120)
      "en" : "",
      "it" : "",
      …
    },
    "summary" : { // summary as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "content" : { // content as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "tags": [ 144, 3, … ], // tags - int(1…)
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "image" : { // image (can be null)
      "name" : "page.jpg", // file name - string(1…255)
      "content" : "N3R…zaA==" // content encoded in Base64 - string
    },
    "imageCaption" : { // image caption - string(0…60)
      "en" : "…",
      "it" : "…",
      …
    },
    "publicationTime" : "2020-03-13 18:12:44" // publication time - datetime
}

Response

{
  "status" : "ok",
  "id" : 71 // identifier of the blog post - int(1…)
}

Errors

Field Type Description
image InvalidValue Image width or height must be greater or equal to <size> pixels
image Malformed File content format '<format>' is not supported
image Malformed File content is corrupted or is not an image
image Malformed File size can not be greater than 2 MB
tags NotFound Blog tag <tag> does not exist

blog-posts.update

Updates a blog post. Any fields left out of the request will remain unchanged.

Request

Admin SDK
Admin.api('site.blog-posts.update', request, function(response) { … });
HTTP POST
/api/v10/site.blog-posts.update
{
  "id" : 71, // identifier of the blog post to update (required) - int(1…)
  "post" : { // blog post to update (required) 
    "author" : "Mark", // author - string(0…50)
    "title" : { // title - string(2) -> string(0…120)
      "en" : "",
      "it" : "",
      …
    },
    "summary" : { // summary as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "content" : { // content as HTML - string(2) -> string(0…65535)
      "en" : "Our company...",
      "it" : "La nostra azienda...",
      …
    },
    "tags": [ 144, 3, … ], // tags - int(1…)
    "seoTitle" : { // title for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "seoDescription" : { // description for SEO - string(2) -> string(0…255)
      "en" : "…",
      "it" : "…",
      …
    },
    "image" : { // image (can be null)
      "name" : "page.jpg", // file name - string(1…255)
      "content" : "N3R…zaA==" // content encoded in Base64 - string
    },
    "imageCaption" : { // image caption - string(0…60)
      "en" : "…",
      "it" : "…",
      …
    },
    "publicationTime" : "2020-03-13 18:12:44" // publication time - datetime
}

Response

{
  "status" : "ok"
}

Errors

Field Type Description
id NotFound Blog post <id> does not exist
image InvalidValue Image width or height must be greater or equal to <size> pixels
image Malformed File content format '<format>' is not supported
image Malformed File content is corrupted or is not an image
image Malformed File size can not be greater than 2 MB
tags NotFound Blog tag <tag> does not exist

blog-posts.delete

Deletes one o more blog posts.

Request

Admin SDK
Admin.api('site.blog-posts.delete', request, function(response) { … });
HTTP POST
/api/v10/site.blog-posts.delete
{
  "ids" : [ 12, 71, … ] // identifiers of the blog posts to delete (required) - int(1…)
}

Response

{
  "status" : "ok"
}