-1

I have server. He return json in next format:

{
    "count": 6, 
    "next": null, 
    "previous": null, 
    "results": [
        {
            "id": 2, 
            "court": "http://reg-corruption.herokuapp.com/api/court/2/", 
            "result": "result2", 
            "date_meeting": "2014-03-12T17:50:30Z"
        }, 
        {
            "id": 3, 
            "court": "http://reg-corruption.herokuapp.com/api/court/2/", 
            "result": "result22", 
            "date_meeting": "2014-03-13T17:50:46Z"
        },   ] }

I want to write client. In client I can copy models.py, but how I can use it to send request to server. Main problem: I have file models.py and it is work with sqlite database. Can I use this file to connect to REST server? And can I load links to foreign key automatically? Or what I mast to read or use?

Detonavomek
  • 432
  • 5
  • 14

1 Answers1

1

You need neither the models.py nor DB to connect to the server. Once you have the REST API url, required headers and authentication details, you can just write a REST client in any language you are comfortable in and connect to the server.

I will put few examples:

From you tags I understand you are using DRF for the server. You can check http://www.django-rest-framework.org/api-guide/testing/ also, for inbuilt testing REST client library in DRF.

yeaske
  • 1,352
  • 14
  • 21