InSales API - Статьи

Материал из Insales Wiki
Перейти к: навигация, поиск

Получение списка

Запрос: GET /admin/blogs/#{id}/articles.xml

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<articles type="array">
  <article>
    <id type="integer">286</id>
    <title>123412341243</title>
    <author>Петр Петрович</author>
    <content><p>1234123421341243</p></content>
    <notice nil="true"/>
    <permalink>123412341243</permalink>
    <html-title nil="true"/>
    <meta-keywords nil="true"/>
    <meta-description nil="true"/>
    <created-at type="timestamp">2010-06-30 00:00:00 +0400</created-at>
    <updated-at type="timestamp">2011-03-05 13:49:36 +0300</updated-at>
  </article>
  <article>
    <id type="integer">103</id>
    <title>1234123</title>
    <author>Петр Петрович</author>
    <content><p>12341234</p></content>
    <notice nil="true"/>
    <permalink>1234123</permalink>
    <html-title nil="true"/>
    <meta-keywords nil="true"/>
    <meta-description nil="true"/>
    <created-at type="timestamp">2010-06-04 12:18:30 +0400</created-at>
    <updated-at type="timestamp">2011-03-05 13:49:32 +0300</updated-at>
  </article>
  <article>
    <id type="integer">102</id>
    <title>2134</title>
    <author>Петр Петрович</author>
    <content><p>12342341243</p></content>
    <notice nil="true"/>
    <permalink>2134</permalink>
    <html-title nil="true"/>
    <meta-keywords nil="true"/>
    <meta-description nil="true"/>
    <created-at type="timestamp">2010-06-04 12:18:24 +0400</created-at>
    <updated-at type="timestamp">2011-03-05 13:49:32 +0300</updated-at>
  </article>
</articles>

Получение информации

Запрос: GET /admin/blogs/#{id}/articles/#{id}.xml

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<article>
  <id type="integer">286</id>
  <title>123412341243</title>
  <author>Петр Петрович</author>
  <content><p>1234123421341243</p></content>
  <notice nil="true"/>
  <permalink>123412341243</permalink>
  <html-title nil="true"/>
  <meta-keywords nil="true"/>
  <meta-description nil="true"/>
  <created-at type="timestamp">2010-06-30 00:00:00 +0400</created-at>
  <updated-at type="timestamp">2011-03-05 13:49:36 +0300</updated-at>
</article>

Добавление

Запрос: POST /admin/blogs/#{id}/articles.xml

<?xml version="1.0" encoding="UTF-8"?>
<article>
  <title>123412341243</title>
  <author>Петр Петрович</author>
  <content><p>1234123421341243</p></content>
</article>

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<article>
  <id type="integer">286</id>
  <title>123412341243</title>
  <author>Петр Петрович</author>
  <content><p>1234123421341243</p></content>
  <notice nil="true"/>
  <permalink>123412341243</permalink>
  <html-title nil="true"/>
  <meta-keywords nil="true"/>
  <meta-description nil="true"/>
  <created-at type="timestamp">2010-06-30 00:00:00 +0400</created-at>
  <updated-at type="timestamp">2010-06-30 00:00:00 +0400</updated-at>
</article>

Изменение

Запрос: PUT /admin/blogs/#{id}/articles/#{id}.xml

<?xml version="1.0" encoding="UTF-8"?>
<article>
  <author>Иванов Иван Иванович</author>
</article>

Ответ:

HTTP/1.1 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<article>
  <id type="integer">286</id>
  <title>123412341243</title>
  <author>Иванов Иван Иванович</author>
  <content><p>1234123421341243</p></content>
  <notice nil="true"/>
  <permalink>123412341243</permalink>
  <html-title nil="true"/>
  <meta-keywords nil="true"/>
  <meta-description nil="true"/>
  <created-at type="timestamp">2010-06-30 00:00:00 +0400</created-at>
  <updated-at type="timestamp">2011-03-05 13:49:36 +0300</updated-at>
</article>

Удаление

Запрос: DELETE /admin/blogs/#{id}/articles/#{id}.xml

Ответ:

HTTP/1.1 200 OK