'Unable to Pass UUID string to API endpoint using POSTMAN Correctly
The API endpoint is something like that, at django backend /accounts/id/uuid:pk/some_action/
in the models it is defined as
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
The apiview accepts requests and pk which is uuid as pk.
@api_view(['PUT'])
def some_action(request, pk):
when i'm making a request with uuid it is giving me following error
Not Found: /accounts/user/{id}/some-action/
[12/Feb/2022 18:41:28] "PUT /accounts/id/%7Bid%7D/some-action/ HTTP/1.1" 404 4930
in Postman i configure the url like this /accounts/id/{id}/some-action/
So what might be the problem in passing the uuid ?
Solution 1:[1]
Please change the the url in the urls.py to /accounts/id/<uuid:pk>/some_action/
Hope it works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
