Reputation: 275
I am going to make a small app but I do not know how to do it that's why I need you advice. For example, I have a api_key
like that API_KEY='AdsbdmAYugjhnvcvbnRDgfcvbnb'
from third party service, let's imagine this computer service group and I need to do is that when I post a computer model number (i.e XS54125) and it should return name, manufacturer, produced date, etc and I should save this details in the database but I do not know how to implement this app. Can you give me idea please? because I have never done this kind of app before. If anything is still unclear please let me know I'll try to explain in more detail. Thank you beforehand!
Upvotes: 0
Views: 208
Reputation: 637
You can follow the django rest framework tutorial to create an endpoint that basically do what you need, it means:
API_KEY
in the settings.py
file using configparser
(i.e: getting the credentials from a settings.ini
file)Computer
model with all the attributes that you'll need (model number, name, manufacturer, produced date, etc)viewsets.ViewSet
instead of viewsets.ModelViewSet
, because you don't need to extract data from a model, but you'll be able to save the response in your Computer
model. Optionally you can create a Serializer to save the data into your Computer
model.Upvotes: 1