Editing a post

From LabTrove Documentation
Jump to: navigation, search

Owing to the evolution of LabTrove Notebooks from a blog-based system, some internal variables do still use the term blog.

Editing a post using the REST API

In the request string, the <action> is editpost, for example:

The XML data that you append to the request string comprises the mandatory information for the post, the content, and optional items such as metadata and attachments. For further information, read the notes associated with the following example of the XML data for an editpost request:

<?xml version="1.0" encoding="UTF-8"?> 
  <id>Mandatory - Read note 1</id>     
  <section>Mandatory - Read note 2</section>        
    <username>Mandatory - Read note 3</username>
    Mandatory - Read note 4
  <datestamp>Optional – Read note 5</datestamp> 
  <blog_sname>The short name of the target {{Blog}}</blog_sname>        
    <key>Optional – Read note 6</key>
    <data>Optional – Read note 7</data> 


  1. To find out how to obtain the identifier of the post that you want to edit, refer to the Understanding the response section in the Adding a post topic.
  2. Use either an existing Section value or a new value if you want to create a new Section
  3. The username must have a system account for the Trove and must have the appropriate authorisation level for the Notebook
  4. The post content can include BBCode markup
  5. If you provide a datestamp, it must conform to the RFC-822 date-time specification
  6. Replace key with the name of the metadata key to which you want to give a value: you can use either an existing key or create a new key. For example, to assert that this post is about Test 42, use <test>42</test>
  7. You can attach data to a post only if the data item has been uploaded previously. To find out how to obtain the identifier of the data item, refer to the Adding data topic.

For example, to attach the data item with data_id 5, use:

<data type="local">5</data>

To attach multiple data items, include a </tt> element for each item. Note that <tt>local</tt> is the only <tt>type</tt> option available with the current implementation.

Understanding the response

LabTrove returns a response in XML format, structured as follows:

<?xml version="1.0" encoding="UTF-8"?>  
  <success>Read note 1</success>
  <status_code>Read note 2</status_code>
  <post_id>Read note 3</post_id>
  <post_info>Read note 4</post_info>


  1. <tt>true</tt> if the request was successful, otherwise <tt>false</tt>
  2. For details of status codes and reason phrases, refer to the Status codes topic
  3. The identifier of the post supplied in the <tt><id></tt> element of the request
  4. URI for the xml version of the added post

What to do next