You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to get a specific room, I want to know which propertyID it belongs to but I don't want to request the propertyObject because it's really big, Only when the user click on a button will I then fetch the property from the Back End.
If I do a GET query https://example.com/rooms/1, the server will reply something like this
You can use sparse fieldset to get certain properties of the child object - https://jsonapi.org/format/#fetching-sparse-fieldsets i.e https://example.com/rooms/1?include=property&fields[property]=title,description,rent it will return
From the JSON API point of view that's perfectly valid but trying to understand the code of angular2-jsonapi, I believe that if the "included" field is not present, the data won't be available in the JsonApiModel
@Tonio-lavanda yes you are right you have to "include" the object i.e https://example.com/rooms/1?include=property&fields[property]=title,description,rent however you can use the the sparse field and just get the id and nothing else so https://example.com/rooms/1?include=property&fields[property]=id
Maybe It is something that I don't understand, apology if that's the case.
I would like to have the option of getting the relationship data from the model even if I don't "include" relationship in my GET request.
Let's say we have a Model like this:
I want to get a specific room, I want to know which propertyID it belongs to but I don't want to request the propertyObject because it's really big, Only when the user click on a button will I then fetch the property from the Back End.
If I do a GET query
https://example.com/rooms/1
, the server will reply something like thisSo in the response from the backend, we have the ID of the corresponding property.
But I'm not able to get this data from my GET query, the only way I was able to retrieve the property ID is when I add
include=property
Is there a way to retrieve all relationship IDs without retrieving the relationship Data ?
Is it the exact same thing than what people are asking in #103 ?
The text was updated successfully, but these errors were encountered: