Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8633193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:27:22+00:00 2026-06-12T09:27:22+00:00

I am sort of stuck while creating something very simple – a new user.

  • 0

I am sort of stuck while creating something very simple – a new user.

Workflow in my head is this: User sents query with the api key. Checks if the user exists or not. if not, create the user.

This is my UserSignUpResource:

   class UserSignUpResource(ModelResource):

        class Meta:
            object_class = User
            queryset = User.objects.all()
            allowed_methods = ['post']
            include_resource_uri = False
            resource_name = 'newuser'
            excludes = ['is_active','is_staff','is_superuser']
            authentication = ApiKeyAuthentication()
            authorization = DjangoAuthorization()
            models.signals.post_save.connect(create_api_key, sender=User)

        def obj_create(self,bundle,request=None,**kwargs):
            try:
                bundle = super(UserSignUpResource, self).obj_create(bundle,request,**kwargs)
                bundle.obj.set_password(bundle.data.get('password'))
                bundle.obj.save()
            except IntegrityError:
                raise BadRequest('The username already exists')
            return bundle
    def apply_authorization_limits(self,request,object_list):
        return object_list.filter(id=request.user.id,is_superuser=True)

My api call:

curl -v -X POST -d '{"username" : "puck", "password" : "123456"}' -H "Authorization: ApiKey puck:link" -H "Content-Type: application/json" http://127.0.0.1:8000/api/v1/newuser/

I get a 401 error. That is precisely because I don’t know how to create an API key so that I can use it to create new users.

I can see a api column in django admin but it allows me to only create one api key per user.
Thus, how does that work? How do I make it work?

Very little information on the tutorials. Hardly any blogs about it. Any help would be nice. I am struggling quite bad.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:27:22+00:00Added an answer on June 12, 2026 at 9:27 am

    You can create ApiKey with:

    ApiKey.objects.create(user=user)
    

    (you can do it through admin interface as well, but be careful that saving empty inline won’t actually save it, ie: change date/time field of api key inline).

    After you have api_key, this should work:

    curl -v -X POST -d '{"username" : "puck", "password" : "123456"}' -H "Content-Type: application/json" http://127.0.0.1:8000/api/v1/newuser/?username=user&api_key=API_KEY
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Been kind of stuck on this one for a while now, so any help
I'm reviewing algorithm stuff and stuck in a simple quick sort algorithm implementation in
I've been stuck on this problem for a while now and have tried my
I am just learning to use Services, and am sort of stuck. I have
I'm kind of stuck with my heap sort here in php: <?php function heapSort($a,
I sort of understand this, at least the function of generators (I've used them
I'm completely new to Python and while trying various random bits and pieces I've
When working on The fastest sort for BrainF*** , I discovered this algorithm, which
I am trying to write merge sort and stuck here. What is the problem
I am fairly new to C# programming and I am stuck on my little

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.