How to talk to API via HTTP on Django

10 views
Skip to first unread message

Dejan Batic

unread,
Jun 25, 2019, 6:31:11 PM6/25/19
to Django users
I'm newbie of course. I have this API documentation and I'm trying to figure out how to make this http request works. 

For example here is the reques that client sends:

GET {URL}/api/{USER}:{PASS}/plaint/play_create*{PARAM1}*{SEQUENCE}*{GROUP}*{PARAM2}

That line is from client and the server is a Django with a database (MySQL or PostgreSQL).

I want to know how to make this http requ

Yoo

unread,
Jun 25, 2019, 7:05:37 PM6/25/19
to Django users
Use Django REST Framework and django-filters. Easy set-up. 
For something you're trying to do, you can send a request like: 
Basically, this goes to the table Testtable, filters the queryset by some column category that returns all categories of science. The returned data would be in the form of json.

You can also do http://127.0.0.1:8000/api/?category=science&user=1/

That'll filter by multiple columns. It's kinda like Testtable.objects.filter(category='science', user=1)

If you're doing something with username and password, use headers. If it's something for mobile, try using JWTAuthentication. 
Reply all
Reply to author
Forward
0 new messages