我已经在django-restframework和django admin的帮助下创建了一个服务器.它是一个简单的服务器,可以响应请求,并带有json格式的音乐列表.
当我输入站点http://127.0.0.1/music/
时,它将显示身份验证页面的链接.身份验证后,我可以看到所有内容,并发布音乐或获取音乐列表.
从我的终端机(ubuntu),我可以使用命令"curl -X POST http://127.0.0.1:8000/music/ -d "code=print 789" -u user:password"
发布一些内容.
但是我非常新手,没有想法,我该如何从我的android应用程序中做到这一点.
我已经看到了许多有关如何使用网络服务的示例,例如这一个,但是没有人显示我如何进行身份验证.
抱歉,如果这是一个琐碎的问题,我只在该项目中工作了几天,而我没有编程知识.
有人可以帮我吗?
I have created a server with help of django-restframework and django admin. Its a simple server that response a request, with a list of musics in json format.
When i enter in the site http://127.0.0.1/music/
it shows link for an authentication page. After authentication i can see all the content, and post a music or get a list of musics.
From my terminal(ubuntu), i can post some content by using the comand "curl -X POST http://127.0.0.1:8000/music/ -d "code=print 789" -u user:password"
.
However i'm very newbie and have no ideia how can i do that from my android app.
I have seen a lot of examples about how consuming webservice, like this one, but no one shows how can i make authentication.
Sorry if this is a trivial question, i'm only working in that project for a few days and i haven't programming knowledge.
Can someone help me?