I want to do simple Rest API in Django. It's my first approach to Rest in django, but for now it isn't going that bad ;)
For now I have a model database with two fields brand
and model
. With the use of Postman, I can GET, POST and DELETE objects, cool.
But what I'm stuck with is ->
When I POST an object, first I'd like to check if that model
with given brand
even exists. I want to check it on specific website: link. (In the URL of that website I can change brand name so it gives me a list of model with given brand)
My approach would be, when request.method=='POST'
first GET data from website, load it to a model and then somehow compare it with data in POST request.
But I don't know how to get to that point :)
Is it a good approach or is there a way to directly look at data on the given website?
(For me there is no need to give you my code, because there is nothing special in it, but tell me if I'm wrong!)