0

I have not worked with Django seriously and my only experience is the tutorials on their site.

I am trying to write my own application now, and what I want is to have some sort of API. My idea is that I will later be able to use it with a client written in any other language.

I have the simplest of all apps, a model that has a name and surname field.

So the idea is that I can now write an app lets say in c++ that will send two strings to my Django app so they can be saved in the database as name, surname respectively.

What I know until now is to create a form so a user can enter that information, or have the information in the url, and of curse adding them myself from the admin menu.

What I want though is some other better way, maybe creating a packet that contains that data. Later my client sends this data to my Django webpage and it will extract the info and save it as needed. But I do not know how to do this.

If my suggested method is a good idea, then I would like an example of how this is done. If not the I would like suggestions for possible things I could try out.

2
  • This is such a broad question. You certainly can do this and there are many packages to help build an API. Commented Jun 23, 2015 at 8:08
  • 1
    It seems like you are simply describing an API. A common way to do that these days is via REST, and there is a Django REST Framework that helps you do exactly that. Commented Jun 23, 2015 at 8:09

1 Answer 1

1

Typically, as stated by @DanielRoseman, you certainly want to:

  • Create a REST API to get data from another web site
  • Get data, typically in JSON or XML, that will contain all the required data (name and surname)
  • In the REST controller, Convert this data to the Model and save the Model to the database
  • Send an answer.

More information here: http://www.django-rest-framework.org/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.