Difference between revisions of "Appending to a post"

From LabTrove Documentation
Jump to: navigation, search
(ezetjpbj)
 
(267 intermediate revisions by 7 users not shown)
Line 1: Line 1:
<a href="https://avodartgen.com/">avodart 0 5mg</a> <a href="https://lisinoprilmd.com/">lisinopril tabs</a> <a href="https://clomid150.com/">clomid for sale</a> <a href="https://furosemide1.com/">furosemide pills</a> <a href="https://furosemidelab.com/">buy furosemide 40 mg tablets uk</a> <a href="https://valtrex24.com/">where can i buy valtrex</a> <a href="https://doxycyclinehycl.com/">can you buy doxycycline online</a> <a href="https://doxycycline20.com/">doxycycline brand name</a>
+
{{Caveat}}
 +
 
 +
== Appending to a post using the [[Using the Rest API|REST API]] ==
 +
 
 +
In the request string, the <tt><action></tt> is <tt>appendpost</tt>, for example: <pre>http://www.ourexperiment.org/api/rest/appendpost/uid/<uid></pre>
 +
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 <tt>appendpost</tt> request:
 +
<pre><?xml version="1.0" encoding="UTF-8"?>
 +
<post>
 +
  <id>Mandatory - Read note 1</id>   
 +
  <title>Optional - will be appended to existing post title</title>
 +
  <section>Optional - will be appended to existing post section</section>       
 +
  <author>               
 +
    <username>Mandatory - Read note 2</username>
 +
  </author>       
 +
  <content>               
 +
    Optional - will be appended to existing post content
 +
  </content>       
 +
  <datestamp>Optional – Read note 4</datestamp>
 +
  <blog_sname>Mandatory - The short name of the target {{Blog}}</blog_sname>       
 +
  <metadata>
 +
    <key>Optional – Read note 5</key>
 +
  </metadata>       
 +
  <attached_data>
 +
    <data>Optional – Read note 6</data>  
 +
  </attached_data>
 +
  <edit_reason>Mandatory</edit_reason>
 +
</post></pre>
 +
 
 +
'''Notes:'''
 +
# 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.
 +
# The username must have a system account for the {{LabTrove Instance}} and must have the appropriate authorisation level for the {{Blog}}
 +
# The post content can include BBCode markup
 +
# If you provide a datestamp, it must conform to the RFC-822 date-time specification
 +
# Replace <tt>key</tt> 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 <tt><test>42</test></tt>
 +
# 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:
 +
<pre><data type="local">5</data></pre> 
 +
To attach multiple data items, include a <tt><data></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:
 +
<pre><?xml version="1.0" encoding="UTF-8"?> 
 +
<result>     
 +
  <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>
 +
</result></pre>
 +
 
 +
'''Notes:'''
 +
# <tt>true</tt> if the request was successful, otherwise <tt>false</tt>
 +
# For details of status codes and reason phrases, refer to the [[Status codes]] topic
 +
# The identifier of the post supplied in the <tt><id></tt> element of the request
 +
# URI for the xml version of the added post
 +
 
 +
===What to do next===
 +
* [[Adding a post]]
 +
* [[Editing a post]]
 +
* [[Adding data]]
 +
* For information about status and reason codes from {{LabTrove Product}}, see [[Status codes]].
 +
 
 +
{{End of topic}}

Latest revision as of 12:47, 9 December 2021

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

Appending to a post using the REST API

In the request string, the <action> is appendpost, for example:
http://www.ourexperiment.org/api/rest/appendpost/uid/<uid>

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 appendpost request:

<?xml version="1.0" encoding="UTF-8"?> 
<post> 
  <id>Mandatory - Read note 1</id>     
  <title>Optional - will be appended to existing post title</title>
  <section>Optional - will be appended to existing post section</section>        
  <author>                
    <username>Mandatory - Read note 2</username>
  </author>        
  <content>                
    Optional - will be appended to existing post content
  </content>        
  <datestamp>Optional – Read note 4</datestamp> 
  <blog_sname>Mandatory - The short name of the target {{Blog}}</blog_sname>        
  <metadata> 
    <key>Optional – Read note 5</key>
  </metadata>        
  <attached_data>
    <data>Optional – Read note 6</data> 
  </attached_data>
  <edit_reason>Mandatory</edit_reason> 
</post>

Notes:

  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. The username must have a system account for the Trove and must have the appropriate authorisation level for the Notebook
  3. The post content can include BBCode markup
  4. If you provide a datestamp, it must conform to the RFC-822 date-time specification
  5. 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>
  6. 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"?>  
<result>      
  <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>
</result>

Notes:

  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