PeopleAggregator API: method peopleaggregator.newContent

Arguments | Return value | REST (XML) example | REST (JSON) example | XML-RPC example

Method: peopleaggregator.newContent

Add a content item (a blog post, or any SB microcontent type) to the system.

Arguments (see also Authentication)

If calling by XML-RPC, note that this method takes a single struct as input, with the following keys:

authToken

Type: string
An authentication token for the user creating the content.
Example: as9d867f234o7asdf:928734982734987234:298374982734987234

context

Type: string
Where to place the content: leave blank to post to your blog, pass a user ID to post to another user's blog (currently not permitted), or pass a group ID to post to a group blog.
Example: user:26
Default:

title

Type: string
Title of the content item.
Example: PeopleAggregator lives!

content

Type: string
Content of the content.
Example: Testing, testing - this is the first post.
Default:

trackbacks

Type: string
Space-separated list of URLs to trackback.
Example: http://topicexchange.com/t/test/ http://example.org/foobar/trackback
Default:

tags

Type: string
Comma-separated list of tags.
Example: peepagg, people aggregator

Return value (see also Exceptions)

Type: hash

Attributes:

success

Type: boolean
true if the content has been successfully saved, or false on failure.
Example: True

id

Type: string
ID of the created content.
Example: content:1234

url

Type: string
The URL of the created content.
Example: http://example.org/peepagg/content.php?cid=1234

msg

Type: string
Human-readable status message
Example: Added content to myelin's blog.

errors

Type: array

Content of each item:

item

Type: hash

Attributes:

code

Type: string
Machine-readable error message
Example: trackback_failed

msg

Type: string
Human-readable status message
Example: Trackback to http://example.com/bad-url failed

Example REST (XML) request

Request

POST /api/xml/peopleaggregator/newContent HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 308

authToken=as9d867f234o7asdf%3A928734982734987234%3A298374982734987234&content=Testing%2C+testing+-+this+is+the+first+post.&context=user%3A26&tags=peepagg%2C+people+aggregator&trackbacks=http%3A%2F%2Ftopicexchange.com%2Ft%2Ftest%2F+http%3A%2F%2Fexample.org%2Ffoobar%2Ftrackback&title=PeopleAggregator+lives%21

Response

HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: 545

<response>
 <url>http://example.org/peepagg/content.php?cid=1234</url>
 <msg>Added content to myelin's blog.</msg>
 <errors>
  <item>
   <msg>Trackback to http://example.com/bad-url failed</msg>
   <code>trackback_failed</code>
  </item>
 </errors>
 <id>content:1234</id>
 <success>true</success>
</response>

Example REST (JSON) request

Request

POST /api/json/peopleaggregator/newContent HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 308

authToken=as9d867f234o7asdf%3A928734982734987234%3A298374982734987234&content=Testing%2C+testing+-+this+is+the+first+post.&context=user%3A26&tags=peepagg%2C+people+aggregator&trackbacks=http%3A%2F%2Ftopicexchange.com%2Ft%2Ftest%2F+http%3A%2F%2Fexample.org%2Ffoobar%2Ftrackback&title=PeopleAggregator+lives%21

Response

HTTP/1.1 200 OK
Content-Type: application/x-javascript
Content-Length: 238

{"url": "http://example.org/peepagg/content.php?cid=1234", "msg": "Added content to myelin's blog.", "errors": [{"msg": "Trackback to http://example.com/bad-url failed", "code": "trackback_failed"}], "id": "content:1234", "success": true}

Example XML-RPC call

Request

POST /api/xmlrpc HTTP/1.1
Content-Type: text/xml
Content-Length: 2263

<?xml version='1.0'?>
 <methodCall>
  <methodName>peopleaggregator.newContent</methodName>
  <params>
   <param>
    <value><struct>
     <member>
      <name>authToken</name>
      <value><string>as9d867f234o7asdf:928734982734987234:298374982734987234</string></value>
     </member>
     <member>
      <name>tags</name>
      <value><string>peepagg, people aggregator</string></value>
     </member>
     <member>
      <name>trackbacks</name>
      <value><string>http://topicexchange.com/t/test/ http://example.org/foobar/trackback</string></value>
     </member>
     <member>
      <name>title</name>
      <value><string>PeopleAggregator lives!</string></value>
     </member>
     <member>
      <name>content</name>
      <value><string>Testing, testing - this is the first post.</string></value>
     </member>
     <member>
      <name>context</name>
      <value><string>user:26</string></value>
     </member>
    </struct></value>
   </param>
  </params>
 </methodCall>
 

Response

HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 2730

<?xml version='1.0'?>
 <methodResponse>
  <params>
   <param>
    <value><struct>
     <member>
      <name>url</name>
      <value><string>http://example.org/peepagg/content.php?cid=1234</string></value>
     </member>
     <member>
      <name>msg</name>
      <value><string>Added content to myelin's blog.</string></value>
     </member>
     <member>
      <name>errors</name>
      <value><array><data>
       <value><struct>
        <member>
         <name>msg</name>
         <value><string>Trackback to http://example.com/bad-url failed</string></value>
        </member>
        <member>
         <name>code</name>
         <value><string>trackback_failed</string></value>
        </member>
       </struct></value>
      </data></array></value>
     </member>
     <member>
      <name>id</name>
      <value><string>content:1234</string></value>
     </member>
     <member>
      <name>success</name>
      <value><boolean>1</boolean></value>
     </member>
    </struct></value>
   </param>
  </params>
 </methodResponse>