尝试使用Android REST API根据条件值检索一个对象 [英] trying to retrieve one object based on conditions values using Android REST API

查看:79
本文介绍了尝试使用Android REST API根据条件值检索一个对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Parse.com,并尝试使用Android REST API根据条件值检索一个对象

I’m using Parse.com, and trying to retrieve one object based on conditions values using Android REST API

这是REST API的Parse文档的摘录

here is a snippet from the Parse documentation for the REST API

curl -X GET \
     -H "X-Parse-Application-Id: MYAPPID" \
     -H "X-Parse-REST-API-Key: MYRESTKEY" \
     -G \
     --data-urlencode 'where={"$relatedTo":{"object":{"__type":"Pointer","className":"Post","objectId":"8TOXdXf3tz"},"key":"likes"}}' \
 https://api.parse.com/1/users

如何在android中实现呢?

How can I achieve this in android?

推荐答案

它是基于curl的api,您必须显式传递其所有参数. 我建议您首先使用Postman等客户端应用程序来测试api.

It's curl based api, you have to explicitly pass all its parameter. I recommending you to first test api using client application like Postman.

-X定义GET,POST,PUT,DELETE之类的术语

-X define term like GET,POST,PUT,DELETE

-H define头,它具有键值形式的数据,并用:"符号分隔.

-H define header, which has key-value form data separated by ":" sign.

-G使用时,将在HTTP GET请求中使用所有数据,而不是在其他情况下将使用的POST请求.数据将以'?'附加到URL.分隔符.

-G When used, all data to be used in an HTTP GET request instead of the POST request that otherwise would be used. The data will be appended to the URL with a '?' separator.

传递所有这些参数并对其进行测试,一旦它们可以正常工作,然后将其实现到您的应用程序中.

Pass all these parameters and test it, once it is working fine then implement to your application.

这篇关于尝试使用Android REST API根据条件值检索一个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆