Package: django-users-api
Django users RESTful API usingTastypie. This django app provides RESTful interface to:Django UserDjango GroupDjango PermissionInstallpip install django-users-apior from cloned repopython setup.py installDevelopmentRun tests:$ virtualenv venv
$ . venv/bin/activate
$ pip install -r requirements.txt
$ python setup.py testIntegrationYou can integratedjango-users-apiapp within your django app in various ways.URLConfig (default)Adddjango-users-apidefault urls to your projects urls. In the following example, we will include ourusers_api.urlsprefixed with ‘auth/’.In project urls.py:from django.conf.urls import patterns, include, url

urlpatterns = patterns(
    '',
    # ...,
    url(r'^auth/', include('users_api.urls')),
    # ...
)Theusers_apiURLs will be accessible via:/auth/users/
/auth/groups/
/auth/permissions/
...Selected ResourcesIn some cases you might need to exclude some resources from your project urls. In this case you will have to add therequiredresource(s) yourself.Assuming you only require theUsersResourceto be available (i.e. excludingGroupsResource&PermissionsResource)In project urls.py:from django.conf.urls import patterns, include, url

from users_api.common import UsersApi
from users_api.api.users import UsersResource

django_users_api = UsersApi()
django_users_api.register(UsersResource())

urlpatterns = patterns(
    '',
    # ...
    url(r'', include(django_users_api.urls)),
    # ...
)TheUsersResourceurl will be accessible via:/users/ResourcesUsersResourceA tastypie ModelResource fordjango.contrib.auth.models.User.GETList all users:/users/List user 1:/users/1/User JSON response example:{
    "dateJoined": "2014-12-24T13:04:36",
    "email": "admin@admin.com",
    "firstName": "",
    "isActive": true,
    "isStaff": true,
    "isSuperuser": true,
    "lastLogin": "2015-01-03T14:19:41.060600",
    "lastName": "",
    "resourceUri": "/users/1/",
    "username": "admin"
}POSTCreate new user:/users/Important: Creating user requires apasswordfield to be submitted with data.User JSON request payload example:{
    "email": "new-user@admin.com",
    "firstName": "New",
    "lastName": "User",
    "username": "new_user"
    "password": "us3rP@sswd"
}PUTUpdate existing user:/users/1/Submitting password field will change the user password.DELETEDelete existing user:/users/2/GroupsResourceA tastypie ModelResource fordjango.contrib.auth.models.Group.GETList all groups:/groups/List group 1:/groups/1/List user 1 groups:/users/1/groups/Group JSON response example:{
    "name": "Group name",
    "resourceUri": "/groups/1/"
}POSTCreate new group:/groups/Group JSON request payload example:{
    "name": "HR Group"
}PUTUpdate existing group:/groups/1/Assign group 1 to user 1:/users/1/groups/1/DELETEDelete existing group:/groups/2/Remove group 1 from user 1:/users/1/groups/1/PermissionsResourceA tastypie ModelResource fordjango.contrib.auth.models.Permission.GETList all permissions:/permissions/List permission 1:/permissions/1/List user 1 permissions:/users/1/permissions/List group 1 permissions:/groups/1/permissions/Permission JSON response example:{
    "codename": "add_logentry",
    "contentTypeUri": "/contenttypes/1/",
    "name": "Can add log entry",
    "resourceUri": "/permissions/1/"
}POSTCreate new permission:/permissions/Important: A valid permission should reference a valid ContentType viacontentTypeUrifield (seeContentTypesResource).Permission JSON request payload example (assuming we have aBlogmodel):{
    "codename": "add_blog",
    "contentTypeUri": "/contenttypes/20/",
    "name": "Can add new blog",
}PUTUpdate existing permission:/permissions/1/Assign permission 1 to user 1:/users/1/permissions/1/Assign permission 1 to group 1:/groups/1/permissions/1/DELETEDelete existing permission:/permissions/2/Remove permission 1 from user 1:/users/1/permissions/1/Remove permission 1 from group 1:/groups/1/permissions/1/ContentTypesResourceA Read-only tastypie ModelResource fordjango.contrib.auth.models.ContentType.GETList all contenttypes:/contenttypes/List contenttype 1:/contenttypes/1/ContentType JSON response example:{
    "appLabel": "admin",
    "model": "logentry",
    "name": "log entry",
    "resourceUri": "/contenttypes/1/"
}AuthenticationBy default, all resources use TastypieSessionAuthentication.AuthorizationBy default, all resources use TastypieDjangoAuthorization.Important: DjangoAuthorization givesRead accessto all users, which might not be the desired behavior.ExtendDjango-users-api resources are based on TastypieModelResource class, which gives you the ability to extend and override any of theusers_apiresources.LicenseMIT License.