We use cookies (just for analytics) on this website. If you continue we will assume you are happy with it. ok

BeBanjo

Back to index

Note

Note: This resource links cannot be expanded.

A note make possible to associate some text to an entity denoted by the annotable link

In Movida land, a note looks like this:

<?xml version='1.0' encoding='utf-8' ?>
<note>
  <text>This is a note</text>
  <link rel="annotable" href="https://movida.bebanjo.net/api/titles/1"/>
</note>

Valid attributes

  • text (required): the text that compose the note.

Get a specific note

This is a good way to recover information about a specific note of a title. First retrieve the titles

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/titles/1

And it contains the note link to where request for the creation of its note

<?xml version="1.0" encoding="UTF-8"?>
<title>
  <id type="integer">1</id>
  <!-- ... -->
  <link rel="note" href="https://movida.bebanjo.net/api/titles/1/note"/>
</title>

Then just query the url of the note link

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/titles/1/note

Movida will return the full XML of the note if exists:

<?xml version='1.0' encoding='utf-8' ?>
<note>
  <text>A note</text>
  <link rel="annotable" href="https://movida.bebanjo.net/api/titles/1"/>
</note>

Creating a note

To create a note, you just need to POST a proper XML representation of a note, similar to what you get when fetching one, to the proper endpoint.

For example, this POST would create a note for a title (we’ll use curl’s @ option, which reads the data that is to be posted to the URL from a file):

$ curl --digest -u robot_user:password https://movida.bebanjo.net/api/titles/1

And it contains the note link to where request for the creation of its note

<?xml version="1.0" encoding="UTF-8"?>
<title>
  <id type="integer">1</id>
  <!-- ... -->
  <link rel="note" href="https://movida.bebanjo.net/api/titles/1/note"/>
</title>
cat note.xml
<?xml version="1.0" encoding="UTF-8"?>
<note>
  <text>A note</text>
</note>
$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X POST -d @note.xml "https://movida.bebanjo.net/api/titles/1/note"

Movida will return the full XML of the note just created:

<?xml version='1.0' encoding='utf-8' ?>
<note>
  <text>A note</text>
  <link rel="annotable" href="https://movida.bebanjo.net/api/titles/1"/>
</note>

Updating notes

You can update notes issuing a PUT request to the URL of a given note, as the following example illustrates. This example only updates the note’s text.

Note: The note can be updated only if it’s there.

$ cat note.xml
<note>
  <text>A new note</text>
</note>

Now we send the XML as the body of a PUT request to the title note’s URL:

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X PUT -d @note.xml "https://movida.bebanjo.net/api/titles/4/note"

The PUT request would return the updated XML of the note:

<?xml version='1.0' encoding='utf-8' ?>
<note>
  <text>A note</text>
  <link rel="annotable" href="https://movida.bebanjo.net/api/titles/1"/>
</note>

Deleting notes

The following example shows how to destroy a particular note. Only a DELETE HTTP request to its URL is required:

$ curl --digest -u robot_user:password -H "Content-Type: application/xml" -X DELETE "https://movida.bebanjo.net/api/titles/4/note"

The DELETE request doesn’t return anything, as that note is now gone. If the note does not exist it will return a not found status code.

Last updated January 24th, 2020.