GET content-blocks

Overview

GET content-blocks returns a list of content blocks (i.e., blocks of attachments, text, html and javascript code used in one or more masters) that includes the ID, the last updated date and time, and the name.

Resource URI

 https://api.yesmail.com/v2/content-blocks

Request Parameters

Parameter Required Description
limit Optional Limits how many content blocks are included in the response. By default the limit is 25, the maximum is 100 and the minimum is 0 (zero), which returns only counts.
offset Optional Determines how many content blocks to skip before returning content blocks. The content blocks are sorted by descending last updated time.

HTTP Return Codes

Code Description
200 OK Returned when the query string parameters are valid. The payload will have the matching content blocks. There may be zero matches for a search, and this will still produce a 200 OK response. The count and match will be zero and the content block array will be empty. 
400 Bad Request Returned if an invalid query string parameter or value was used. The error message will specify the exact problem.
401 Unauthorized Api-Key or Api-User headers are missing or invalid.

Response Payload Parameters

Parameter Description
counts

Collection of counts for the payload and totals in the content blocks data store. Only non-archived content blocks are included.

  • count – Number of content blocks included in the payload (does not include deleted). This is anywhere from 0 to 100, with the default being 25.
  • total – Total number of (excludes deleted) content blocks available in the data store for the Api-User.
content blocks

Array of content blocks matching the filtering criteria (if any), paged by limit and offset parameters.

  • id – Unique identifier for the resource. This is also referred to as the content id.
  • lastUpdate – ISO-8601 formatted UTC timestamp for when the content block was last updated.
  • name – Unique name for the content block (per Api-User).

 

Request

This request has no body, but takes URI parameters.

> METHOD /v2/content-blocks?limit=2 HTTP/1.1
> Host: api.yesmail.com
> Accept: application/json
> Content-Type: application/json

Response

Response returns the first two content blocks

{
  "counts": {
    "count": 2,
    "total": 185
  }
  "blocks": [
    {
      "id": "1",
      "lastUpdate": "2014-04-29T16:08:32Z",
      "name": "unique-content-name-1",
      "subscription": [
		"4 finger club"
	]
    },
    {
      "id": "2",
      "lastUpdate": "2014-04-11T11:12:14Z",
      "name": "unique-content-name-2".
      "subscription": [
		"4 finger club".
                "banjo lovers"
	]
    }
  ]
}