Skip to content

RSR_Partner API Read

Michael edited this page Nov 4, 2021 · 7 revisions

Background information

The RSR API can be found on this URL http://rsr.akvo.org/rest/v1/, which is based on the Django Rest Framework.

Dataset

The full RSR dataset, except for privacy sensitive data like password hashes, is exposed through the RSR API.

Example resource

An example resource, taken from http://rsr.akvo.org/rest/v1/project_update/4684/, will show the following JSON output:

{
    "locations": [],
    "photo": "/media/cache/8a/55/8a552db266c27df2239d783aae3b1997.jpg",
    "id": 4684,
    "created_at": "2014-02-11T15:49:33",
    "last_modified_at": "2014-02-11T15:49:33",
    "project": 2,
    "user": 661,
    "title": "Weather Conditions",
    "text": "The heavy rains have come early in Nairobi. January and February are considered the hottest months giving way to rains in March.\nRain seems to bring out the worst - traffic,  hiked fares, to mention a few.",
    "language": "en",
    "primary_location": null,
    "photo_caption": "",
    "photo_credit": "",
    "video": "",
    "video_caption": "",
    "video_credit": "",
    "update_method": "M",
    "user_agent": "",
    "uuid": "",
    "notes": "",
    "absolute_url": "/en/project/2/update/4684/"
}

Or the XML version (add format=xml as a parameter):

<root>
  <locations/>
  <photo>/media/cache/8a/55/8a552db266c27df2239d783aae3b1997.jpg</photo>
  <id>4684</id>
  <created_at>2014-02-11T15:49:33</created_at>
  <last_modified_at>2014-02-11T15:49:33</last_modified_at>
  <project>2</project>
  <user>661</user>
  <title>Weather Conditions</title>
  <text>
    The heavy rains have come early in Nairobi. January and February are considered the hottest months giving way to rains in March. Rain seems to bring out the worst - traffic, hiked fares, to mention a few.
  </text>
  <language>en</language>
  <primary_location/>
  <photo_caption/>
  <photo_credit/>
  <video/>
  <video_caption/>
  <video_credit/>
  <update_method>M</update_method>
  <user_agent/>
  <uuid/>
  <notes/>
  <absolute_url>/en/project/2/update/4684/</absolute_url>
</root>

Filters and parameters

It is possible for any resource to filter on several fields, such as project or partner, by adding a parameter with the id of the object. E.g. ?project=2 to filter on project id 2. In addition, there's several standard parameters that go for every resource:

  • format: Either json or xml. Defaults to html.
  • limit: The number of objects per page. Defaults to 30, with a max of 100.
  • ordering: Order on any field. Prepend an '-' to reverse ordering.

API code of conduct

When using the Akvo RSR API, please respect our API Code of Conduct: http://www.akvo.org/web/akvo-rsr-api-code-of-conduct.