onadata.apps.api.viewsets.osm_viewset module

Module contents

The osm API endpoint.

class onadata.apps.api.viewsets.osm_viewset.OsmViewSet(**kwargs)

Bases: AuthenticateHeaderMixin, CacheControlMixin, ETagsMixin, DefaultBaseViewset, ReadOnlyModelViewSet

This endpoint provides public access to OSM submitted data in OSM format. No authentication is required. Where:

  • pk - the form unique identifier

  • dataid - submission data unique identifier

  • owner - username of the owner(user/organization) of the data point

## GET JSON List of data end points

Lists the data endpoints accessible to requesting user, for anonymous access a list of public data endpoints is returned.

<pre class=”prettyprint”> <b>GET</b> /api/v1/osm </pre>

> Example > > curl -X GET https://ona.io/api/v1/osm

## OSM

The .osm file format concatenates all the files for a form or individual

submission. When the .json endpoint is accessed, the individual osm files are listed on the _attachments key.

### OSM endpoint for all osm files uploaded to a form concatenated.

<pre class=”prettyprint”> <b>GET</b> /api/v1/osm/<code>{pk}</code>.osm </pre>

> Example > > curl -X GET https://ona.io/api/v1/osm/28058.osm

### OSM endpoint with all osm files for a specific submission concatenated.

<pre class=”prettyprint”> <b>GET</b> /api/v1/osm/<code>{pk}</code>/<code>{data_id}</code>.osm </pre>

> Example > > curl -X GET https://ona.io/api/v1/osm/28058/20.osm

extra_lookup_fields = None
filter_queryset(queryset)

Filters the queryset using the pk when used.

get_object()

Returns the Instance object using the pk and dataid lookup values.

get_serializer_class()

Returns the OSMSiteMapSerializer class when list API is invoked.

list(request, *args, **kwargs)

Returns a list of URLs to the individual XForm OSM data.

lookup_field = 'pk'
lookup_fields = ('pk', 'dataid')
permission_classes = (<class 'rest_framework.permissions.AllowAny'>,)
public_data_endpoint = 'public'
queryset
renderer_classes = [<class 'onadata.libs.renderers.renderers.OSMRenderer'>, <class 'rest_framework.renderers.JSONRenderer'>]
retrieve(request, *args, **kwargs)

Returns a single Instance JSON object API response

serializer_class

alias of OSMSerializer