How do you manage documents in the database?

The native API for Syncato is a REST style web services interface. This interface builds on the basic functions of the HTTP protocol to provide complete control of the data in the system. The HTTP methods that are supported by the system are:

  • GET - Used to retrieve documents from the database and to execute queries against the database,
  • POST - Used to add new documents to the database.
  • PUT - Used to update existing documents in the database.
  • DELETE - Used to remove existing documents from the database.

The GET method is the most complex as it allows you to retrieve data from Syncato in a number of different ways. This list provides a summary of the operations that can be performed via a GET request.

The POST method is used to create new entries by posting XML to the base URL for the site. The XML content is passed as the body of the request. For instance if the base URL is http://www.example.com/syncato/blog then you would make an HTTP POST request to that URL and include the new entry as the only content of the body.

The PUT method updates an existing XML fragment in the system. To update a fragment you need to know the id for that fragment and then include it in the URL used for the PUT request. For instance if the id of the entry you want to update is 1023 then making a PUT request to http://www.example.com/syncato/blog/1023 with the new content for the entry will result in it being updated.

The DELETE request is similar but doesn't have any XML content in the body of the request. It's simply an HTTP DELETE made on the URL for the entry. For instance to delete entry 1023 you make a DELETE request to http://www.example.com/syncato/blog/1023.

The POST, PUT and DELETE requests are restricted to authorized users only. Authentication is handled via HTTP basic authentication and if strong security is required all requests should be made using an SSL encrypted connection.

Posted by Kimbro Staken

Tuesday Nov 25, 2003 at 2:38 PM
Recommended Sites