I want to try something that looks like this:
GET/v2.8/PageFacebook/posts?fields="all??"
This is because by default it does not bring me the "name" or "type" of the post. And I don't want to do the field-by-field consultation.
If you want to have the list of all available fields, you need to do a query on a Post Id like this:
GET/v2.8/PostId?metadata=1
Then you can make your selection and specify which fields do you want in your future request.
For instance:
/GET/v2.8/PageFacebookId/posts?fields=id,promotion_status,target,shares,message_tags,source,place,event,parent_id,reactions.limit(0).summary(true),child_attachments,message,caption,story,full_picture,picture,link,name,description,type,status_type,created_time,comments.limit(0).summary(true),sharedposts,privacy,updated_time,story_tags,permalink_url,coordinates
Related
match /my-data/{userId}
{
allow write: if "name" in request.resource.data;
}
This above validates if name is in the data. But it also allows any other data to be written along with "name". What do I do if I only want name in the data, and if any other data is provided, then deny write operation?
You're looking for the List.hasOnly operation, which allows you to ensure a list has only certain members.
Something like this:
request.resource.data.keys().hasOnly("name")
If the document can already contain any fields, but only the name field is allowed to be modified, you'll want to combine hasOnly wih the map.diff() operation.
So that'd be something like this:
resource.data.diff(request.resource.data).keys().hasOnly("name")
I'm sending a request to PUT /{realm}/groups/{id} to add a group attribute to an existing group.
The body of PUT request looks like this:
{"attributes":{"id":123}}
It's failing and returning 500 error.
The documentation is not clear about the format of "Map" schema. https://www.keycloak.org/docs-api/6.0/rest-api/#_grouprepresentation shows "attributes" field type is "Map" but it's not defined. I tried several formats, like:
{"attributes":[{"id":123}]}
{"attributes":{"key":"id","value":123}}
{"attributes":[{"key":"id","value":123}]}
but none of them is working.
What is "Map" schema and why is my request returning 500?
You can create group along with attribute, request body will be
{"name":"myGroup","attributes":{"attr1":["value1"]}}
with two attributes it should be something like this
{"name":"mygroup","attributes":{"attr2":["value2"],"attr1":["value1"]}}"
I have two entities Properties and Bookings.
I need to know the URL structure in case I'm filtering the properties base on query on bookings.
In my case I need to get the properties which are free (not occupied) at specific date.
Can it be
api/properties/free/{date}
Or
api/properties/bookings?bookingDate!='1-1-2017'
Or
api/properties?bookingDate!='1-1-2017'
it seems for me that the last one is the more appropriate but the filter is on the bookings not on the properties which is not obvious.
The Facebook Graph API has a interesting way of doing nested queries by using a strategy of fields filter.
The fields filter it´s a way of filter specific fields or nested fields of a rouserce. They also create a standard way to inform functions for every selected field like: limit or equal.
Your request would be something like this:
GET /api/properties?fields=bookings{bookingDate.notEqual('1-1-2017')}
For more information about Facebook´s GraphAPI:
https://developers.facebook.com/docs/graph-api/overview/
I would like to get user history between two dates (get history for one month for example). Is there a way to add param in url ? something like :
http://api.deezer.com/user/me/history?start=1483522674&end=1483609074
Thanks
Unfortunately, it is not possible, but instead you can use the "limit" and "index" parameters.
I'm working on a REST interface, but am not sure of the best way to structure a "get first/last element" on a collection?
Eg, different options might be:
GET cart/product?id=first_element
GET cart/products?filter=first_element
... something else?
If there is a "standard" way of doing this, what is it? If there is no standard way, how would you do it and why?
Cheers,
I'd use the second option:
GET /cart/products?filter=first_element
id should be reserved for identity.
You could also do something like this:
GET /cart/products/12 # a product identified by ID
GET /cart/products/first # a product identified by a pseudo ID
GET /cart/products/last # a product identified by a pseudo ID