Change theme:   

Articles

Articles resource is located at /admin/api/articles.

Summary of article endpoints

Get data for a single article

GET - /admin/api/articles/1

Example request:

GET - http://helloworld.edicy.co/admin/api/articles/1

Example response:

Status: 200 OK
{
  "id": 1,
  "title": "Having sample news pieces?",
  "path": "having-sample-news-pieces",
  "comments_count": 0,
  "publishing": true,
  "published": true,
  "data": {},
  "created_at": "2014-01-23T09:19:04.000Z",
  "updated_at": "2014-01-23T09:19:04.000Z",
  "published_at": "2014-01-23T09:19:04.000Z",
  "url": "http://helloworld.edicy.co/admin/api/articles/1",
  "public_url": "http://helloworld.edicy.co/blog/having-sample-news-pieces",
  "contents_url": "http://helloworld.edicy.co/admin/api/articles/1/contents",
  "comments_url": "http://helloworld.edicy.co/admin/api/articles/1/comments",
  "page": {
    "id": 3,
    "title": "Blog",
    "content_type": "blog",
    "created_at": "2014-01-23T09:19:04.000Z",
    "updated_at": "2014-01-23T09:19:04.000Z",
    "published_at": "2014-01-23T09:19:04.000Z",
    "url": "http://helloworld.edicy.co/admin/api/pages/3"
  },
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2014-01-23T09:19:04.000Z",
    "updated_at": "2014-01-23T09:19:04.000Z"
  },
  "author": {
    "id": 1,
    "name": "John Smith",
  },
  "autosaved_title": "Having sample news pieces?",
  "excerpt": "Post news of any subject your audience would appreciate.",
  "autosaved_excerpt": "Post news of any subject your audience would appreciate.",
  "body": "The above is excerpt of the article. It appears in the blog post listing. This here is the body of the post. This only appears here, on the post page.",
  "autosaved_body": "The above is excerpt of the article. It appears in the blog post listing. This here is the body of the post. This only appears here, on the post page.",
  "tag_names": []
}

Update attributes of a single article

PUT /admin/api/articles/1

This request updates the article with provided attributes. NB! Currently only attribute data is allowed to update.

Example request:

PUT - http://helloworld.edicy.co/admin/api/articles/3

Example data:

{
  "article": {
    "data": {
      "my_key_1": "Value 1",
      "my_key_2": 2
    }
  }
}

Example response:

Status: 200 OK
{
  "id": 3,
  "title": "Updated title of article 1",
  "path": "my-new-article",
  "comments_count": 0,
  "publishing": true,
  "published": true,
  "data": {
    "my_key_1": "Value 1",
    "my_key_2": 2
  },
  "created_at": "2014-01-01T00:00:00.000Z",
  "updated_at": "2014-01-23T10:03:04.000Z",
  "published_at": "2014-01-23T10:03:04.000Z",
  "url": "http://helloworld.edicy.co/admin/api/articles/3",
  "public_url": "http://helloworld.edicy.co/blog/my-new-article",
  "contents_url": "http://helloworld.edicy.co/admin/api/articles/3/contents",
  "comments_url": "http://helloworld.edicy.co/admin/api/articles/3/comments",
  "page": {
    "id": 3,
    "title": "Blog",
    "content_type": "blog",
    "created_at": "2014-01-23T09:19:04.000Z",
    "updated_at": "2014-01-23T09:19:04.000Z",
    "published_at": "2014-01-23T09:19:04.000Z",
    "url": "http://helloworld.edicy.co/admin/api/pages/3"
  },
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2014-01-23T09:19:04.000Z",
    "updated_at": "2014-01-23T09:19:04.000Z"
  },
  "author": {
    "id": 1,
    "name": "John Smith"
  }
}

Parameters

Optional parameters:

  • data - key/value based custom hash store. (NB! Keys with suffix edicy_ is protected and read only.)

Update data field of an article

PUT /admin/api/articles/1/data/custom_field

Updates or adds a new key to article data keyset.

Example request:

PUT http://helloworld.edicy.co/admin/api/articles/1/data/my_new_key

Example data:

{
  "value": ["foo", "bar"]
}

Example response:

Status: 200 OK
{
  "id": 3,
  "title": "Updated title of article 1",
  "path": "my-new-article",
  "comments_count": 0,
  "publishing": true,
  "published": true,
  "data": {
    "my_key_1": "Value 1",
    "my_key_2": 2,
    "my_new_key": ["foo", "bar"]
  },
  "created_at": "2014-01-01T00:00:00.000Z",
  "updated_at": "2014-01-23T10:03:04.000Z",
  "published_at": "2014-01-23T10:17:04.000Z",
  "url": "http://helloworld.edicy.co/admin/api/articles/3",
  "public_url": "http://helloworld.edicy.co/blog/my-new-article",
  "contents_url": "http://helloworld.edicy.co/admin/api/articles/3/contents",
  "comments_url": "http://helloworld.edicy.co/admin/api/articles/3/comments",
  "page": {
    "id": 3,
    "title": "Blog",
    "content_type": "blog",
    "created_at": "2014-01-23T09:19:04.000Z",
    "updated_at": "2014-01-23T09:19:04.000Z",
    "published_at": "2014-01-23T09:19:04.000Z",
    "url": "http://helloworld.edicy.co/admin/api/pages/3"
  },
  "language": {
    "id": 1,
    "code": "en",
    "title": "ENG",
    "created_at": "2014-01-23T09:19:04.000Z",
    "updated_at": "2014-01-23T09:19:04.000Z",
    "url": "http://helloworld.edicy.co/admin/api/languages/1"
  },
  "author": {
    "id": 1,
    "name": "John Smith",
    "url": "http://helloworld.edicy.co/admin/api/people/1"
  }
}

Remove a custom field from an article

DELETE /admin/api/articles/1/data/custom_field

Example request:

DELETE - http://helloworld.edicy.co/admin/api/articles/1/data/custom_field

Example response:

Status: 204 No Content