Module ImportFrom alias ImportFrom alias identifier ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad body Assign NameStore ListLoad TryExcept body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Dict Str ListLoad Call NameLoad BinOpMod Str Dict Str NameLoad orelse If NameLoad body Expr Call NameLoad NameLoad NameLoad NameLoad orelse Expr Call NameLoad NameLoad NameLoad Assign NameStore AttributeLoad NameLoad attr Return ListLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Lambda arguments args NameParam NameParam NameParam defaults Call AttributeLoad NameLoad attr NameLoad NameLoad Return Call NameLoad NameLoad NameLoad NameLoad ListLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Return Call NameLoad NameLoad NameLoad NameLoad decorator_list ClassDef bases NameLoad NameLoad body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore NameLoad Assign NameStore ListLoad AttributeLoad NameLoad attr Assign NameStore TupleLoad NameLoad Assign NameStore Str FunctionDef arguments args NameParam NameParam defaults vararg kwarg body Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore AttributeLoad NameLoad attr Assign NameStore ListLoad Assign NameStore BoolOpOr Call AttributeLoad AttributeLoad NameLoad attr attr Str Call AttributeLoad AttributeLoad NameLoad attr attr Str If BoolOpAnd CompareIn AttributeLoad NameLoad attr ListLoad Str Str Str UnaryOpNot NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore Dict Str ListLoad Call NameLoad Str orelse If CompareEq AttributeLoad NameLoad attr Str body Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad orelse If CompareEq AttributeLoad NameLoad attr Str body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad If BoolOpOr UnaryOpNot NameLoad UnaryOpNot NameLoad body Assign NameStore AttributeLoad NameLoad attr Assign NameStore IfExp NameLoad Call NameLoad BinOpMod Str NameLoad Call NameLoad Str Assign NameStore Dict Str ListLoad NameLoad orelse Expr Call NameLoad NameLoad NameLoad NameLoad orelse If CompareEq AttributeLoad NameLoad attr Str body Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad If CompareIn NameLoad ListLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Assign NameStore Call NameLoad NameLoad Assign NameStore ListComp AttributeLoad NameLoad attr comprehension NameStore NameLoad Return Call NameLoad NameLoad keyword NameLoad decorator_list Call NameLoad keyword ListLoad Str Str Str Str decorator_list
N/A django.contrib.auth.models User django.utils.translation ugettext _ rest_framework status rest_framework.viewsets ModelViewSet rest_framework.decorators detail_route rest_framework.response Response onadata.apps.api.models.organization_profile OrganizationProfile onadata.apps.api.tools get_organization_members add_user_to_organization remove_user_from_organization onadata.apps.api permissions onadata.libs.filters OrganizationPermissionFilter onadata.libs.mixins.object_lookup_mixin ObjectLookupMixin onadata.libs.permissions ROLES onadata.libs.serializers.organization_serializer OrganizationSerializer _try_function_org_username N/A N/A f organization username args N/A None N/A N/A data N/A N/A N/A N/A user N/A N/A N/A User objects get username username N/A N/A N/A N/A User DoesNotExist N/A N/A status_code N/A status HTTP_400_BAD_REQUEST N/A data N/A username N/A N/A _ N/A User `%(username)s` does not exist. N/A username username N/A N/A args N/A N/A N/A f organization user args N/A N/A N/A f organization user N/A status_code N/A status HTTP_201_CREATED N/A N/A data status_code N/A _update_username_role N/A N/A organization username role_cls N/A N/A N/A f N/A N/A N/A org user role_cls N/A N/A N/A role_cls add user organization N/A N/A _try_function_org_username f organization username N/A role_cls N/A _add_username_to_organization N/A N/A organization username N/A N/A N/A N/A _try_function_org_username add_user_to_organization organization username N/A _remove_username_to_organization N/A N/A organization username N/A N/A N/A N/A _try_function_org_username remove_user_from_organization organization username N/A OrganizationProfileViewSet N/A ObjectLookupMixin ModelViewSet N/A N/A 
List, Retrieve, Update, Create/Register Organizations

## Register a new Organization
<pre class="prettyprint"><b>POST</b> /api/v1/orgs</pre>
> Example
>
>        {
>            "org": "modilabs",
>            "name": "Modi Labs Research",
>            "email": "modilabs@localhost.com",
>            "city": "New York",
>            "country": "US",
>            ...
>        }

## List of Organizations
<pre class="prettyprint"><b>GET</b> /api/v1/orgs</pre>
> Example
>
>       curl -X GET https://example.com/api/v1/orgs

> Response
>
>       [
>        {
>            "url": "https://example.com/api/v1/orgs/modilabs",
>            "org": "modilabs",
>            "name": "Modi Labs Research",
>            "email": "modilabs@localhost.com",
>            "city": "New York",
>            "country": "US",
>            "website": "",
>            "twitter": "",
>            "gravatar": "https://secure.gravatar.com/avatar/xxxxxx",
>            "require_auth": false,
>            "user": "https://example.com/api/v1/users/modilabs"
>            "creator": "https://example.com/api/v1/users/demo"
>        },
>        {
>           ...}, ...
>       ]

## Retrieve Organization Profile Information

<pre class="prettyprint"><b>GET</b> /api/v1/orgs/{username}</pre>
> Example
>
>       curl -X GET https://example.com/api/v1/orgs/modilabs

> Response
>
>        {
>            "url": "https://example.com/api/v1/orgs/modilabs",
>            "org": "modilabs",
>            "name": "Modi Labs Research",
>            "email": "modilabs@localhost.com",
>            "city": "New York",
>            "country": "US",
>            "website": "",
>            "twitter": "",
>            "gravatar": "https://secure.gravatar.com/avatar/xxxxxx",
>            "require_auth": false,
>            "user": "https://example.com/api/v1/users/modilabs"
>            "creator": "https://example.com/api/v1/users/demo"
>        }

## List Organization members

Get a list of organization members.

<pre class="prettyprint"><b>GET</b> /api/v1/orgs/{username}/members</pre>
> Example
>
>       curl -X GET https://example.com/api/v1/orgs/modilabs/members

> Response
>
>       ["member1", "member2"]

## Add a user to an organization

To add a user to an organization requires a JSON payload of
`{"username": "member1"}`.

<pre class="prettyprint"><b>POST</b> /api/v1/orgs/{username}/members</pre>
> Example
>
>       curl -X POST -d '{"username": "member1"}' https://example.com/api/v1/orgs/modilabs/members -H "Content-Type: application/json"

> Response
>
>       ["member1"]

## Change the role of a user in an organization

To change the role of a user in an organization pass the username and role
`{"username": "member1", "role": "owner|manager|editor|dataentry|readonly"}`.

<pre class="prettyprint"><b>PUT</b> /api/v1/orgs/{username}/members</pre>
> Example
>
>       curl -X PUT -d '{"username": "member1", "role": "editor"}' https://example.com/api/v1/orgs/modilabs/members -H "Content-Type: application/json"

> Response
>
>       ["member1"]

## Remove a user from an organization

To remove a user from an organization requires a JSON payload of
`{"username": "member1"}`.

<pre class="prettyprint"><b>DELETE</b> /api/v1/orgs/{username}/members</pre>
> Example
>
>       curl -X DELETE -d '{"username": "member1"}' https://example.com/api/v1/orgs/modilabs/members -H "Content-Type: application/json"

> Response
>
>       []
 N/A queryset N/A N/A N/A OrganizationProfile objects all N/A serializer_class OrganizationSerializer N/A permission_classes N/A N/A permissions DjangoObjectPermissions N/A filter_backends N/A OrganizationPermissionFilter N/A lookup_field user members N/A N/A self request N/A args kwargs N/A N/A organization N/A N/A self get_object N/A status_code N/A status HTTP_200_OK N/A data N/A N/A username N/A N/A N/A N/A request data get username N/A N/A N/A request query_params get username N/A N/A N/A N/A request method N/A DELETE POST PUT N/A username N/A N/A status_code N/A status HTTP_400_BAD_REQUEST N/A data N/A username N/A N/A _ This field is required. N/A N/A N/A N/A request method POST N/A N/A N/A data status_code N/A _add_username_to_organization organization username N/A N/A N/A N/A request method PUT N/A N/A role N/A N/A N/A request data get role N/A role_cls N/A N/A ROLES get role N/A N/A N/A role N/A role_cls N/A N/A status_code N/A status HTTP_400_BAD_REQUEST N/A message N/A role N/A _ N/A '%s' is not a valid role. role N/A _ This field is required. N/A data N/A role N/A message N/A N/A N/A _update_username_role organization username role_cls N/A N/A N/A N/A request method DELETE N/A N/A N/A data status_code N/A _remove_username_to_organization organization username N/A N/A status_code N/A N/A status HTTP_200_OK N/A status HTTP_201_CREATED N/A N/A members N/A get_organization_members organization N/A data N/A N/A u username N/A u members N/A N/A Response data status status_code N/A N/A detail_route methods N/A DELETE GET POST PUT N/A