问题描述:

Hello Fellow stackers i'd been working with the Parse.com API in order to obtain relational objects in a single Query.

According to the official documentation if you want to retrieve the relational objects from your query you must use the 'include' statement, i'd try it using postman and i am not able to obtain the results that i need.

URL Request

curl -X GET \

-H "X-Parse-Application-Id: PARSE-APP-ID" \

-H "X-Parse-REST-API-Key: PARSE-REST-KEY" \

-G \

--data-urlencode 'include=media, author' \

https://api.parse.com/1/Post/p0rKbcZOjX

The result of this request is always the full data of the Post with it's pointers but it does not include the full data of the related items requested in the include

Response:

{

"author": {

"__type": "Pointer",

"className": "_User",

"objectId": "hZLoiIQE3O"

},

"content": "This is the new updated content!!",

"createdAt": "2014-05-15T19:01:39.235Z",

"media": {

"__type": "Pointer",

"className": "Media",

"objectId": "d62EHxZOhO"

},

"number": 237,

"objectId": "p0rKbcZOjX",

"text": "This is the updated Text!!",

"title": "My Post title",

"updatedAt": "2015-10-16T18:54:33.261Z"

}

The media and author related objects has more fields than the ones shown in there. Any help? Thanks in advance!

网友答案:

After several tries and some revisions i did find the source of the error, in this case you shall use the include clause as an url encode parameter and separate the name of the tables you want to retrieve for example:

include = media,author

This will expand the related objects but only the if the related tables are of kind pointers.

You can find a simple class that allows you to use the Parse.com framework through it API for TvOS in native way.

FFParseTvOS

网友答案:

According to documentation, include will not expand all the fields for you. You need to add those fields using the dot notation. For example media.type or auther.name

相关阅读:
Top