I have been able to retrieve event details using
#graph = Koala::Facebook::API.new(access_token)
#eventSummary = #graph.get_object(eventId)
and getting users list invited using
#eventSummary = #graph.get_connections(eventId, "invited")
I want to get count for all user invited, maybe, Declined and accepted for the event. for which i'm using
#eventSummary = #graph.get_connections(eventId, "invited?summary=1")
which again giving me the list of users only. when used graph.facebook like
https://graph.facebook.com/***eventId***/invited?access_token=*****access_token****&summary=1
i'm getting the count in result.
{
"data": [
{
"name": "xyz",
"rsvp_status": "attending",
"id": "10000000123"
}
],
"paging": {
"next": "https://graph.facebook.com/***eventId***/invited?summary=1&access_token=***accesstoken***&limit=5000&offset=5000&__after_id=100004389574321"
},
"summary": {
"noreply_count": 0,
"maybe_count": 0,
"declined_count": 0,
"attending_count": 1,
"count": 1
}
}
for just solving purpose i'm getting result using fql, as:
#eventSummary = #graph.get_object("fql", :q => "SELECT all_members_count, attending_count, declined_count, not_replied_count, unsure_count FROM event WHERE eid = #{eventId}")
But this is not convenient to use.
Can anyone please help, what am i doing wrong ? To get Event RSVP counts.
I'm using rails v.3.2, for facebook using Koala gem.
Thanks in advance.
I've seen it too, that when you request the event itself, those attendee count fields aren't included. You can use the second parameter to specifically ask for them though:
#eventSummary = #graph.get_object(eventId)
#eventSummary.merge(#graph.get_object(eventId, fields: "attending_count,declined_count,interested_count"))
The first call gets your "standard" event details, something like this:
{"description"=>"Blah blah blah",
"name"=>"My Event Will Rock",
"place"=>{"name"=>"Venue Bar",
"location"=>{"city"=>"Citytown",
"country"=>"United States",
"latitude"=>43.05308,
"longitude"=>-87.89614,
"state"=>"WI",
"street"=>"1216 E Brady St",
"zip"=>"53202"},
"id"=>"260257960731155"},
"start_time"=>"2016-04-22T21:00:00-0500",
"id"=>"1018506428220311"}
The second call gets just those "additional" requested fields:
{"attending_count"=>3,
"declined_count"=>0,
"interested_count"=>12,
"id"=>"1018506428220311"}
You can store them in separate variables, or as I'm suggesting above, use the hash#merge method. (There shouldn't be any problematic overlap between the keys of these two hashes.)
Alternatively, you can get all these details in one request by explicitly requesting everything you want.
Related
I'm using the Microsoft graph api to fetch calendar events.
Now I would like to only fetch events where one of the attendees has a specific name or email address.
An example response describing such an event is
{
"subject": "General meeting",
"attendees": [
{
"emailAddress": {
"name": "Peter Pan",
"address": "peter.pan#neverland.org"
}
},
{
"emailAddress": {
"name": "Captain Hook",
"address": "captain.hook#neverland.org"
}
}
]
}
According to Microsofts documentation the likely way to achieve this is using OData and the any operator. However I can't find a way to access nested properties like name and address using query parameters.
I was hoping I could do something like this
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2022-01-01T00:00:00.000Z&enddatetime=2022-31-01T00:00:00.000Z&$select=attendees,subject&$filter=attendees/any(var:var/emailAddress/address eq 'peter.pan#neverland.org')
but using subparam (emailAddress/address) like that leads to bad request.
If the emailAddress field was just an actual email and not another entity, filtering would work.
https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2022-01-01T00:00:00.000Z&enddatetime=2022-31-01T00:00:00.000Z&$select=attendees,subject&$filter=attendees/any(var:var/emailAddress eq 'peter.pan#neverland.org')
Is it possible to achieve what I want?
According this comment Graph API doesn't support drilling down multiple levels of relationships.
I am working on a Zapier integration for an online form builder. Each unique form for our users has lots of long, auto-generated field names.
We have a trigger called “New form entries”, which polls our server for form entries, and comes back like this:
[
{
"id": "6209aee326baa600224d822c",
"email_907058157108782": "test#test.com",
"phone_589083232390193": "12345",
},
{
"id": "61fd629f19408200225e1893",
"email_907058157108782": "test#test2.com",
"phone_589083232390193": "54321",
},
]
However, this results in end users seeing these really long, gross field names in the Zapier interface:
My question: how do I get Zapier to display friendly labels to the user, whilst using the unique field IDs behind the scenes?
I’m thinking of returning something like the following (each object represents a form entry, , but I need to know how to actually use “friendlyFieldName” and “value” in Zapier!-
[
{
// the id for the entry
"id": "62179ec5ab9daa0022df7d1d",
// the id for the first field entry
"text_576692390099896": {
// a friendly name and value for zapier
"friendlyFieldName": "What is your favourite colour?",
"value": "Blue"
}
}
]
Thank you :)
You can define output fields labels in outputFields. Here are the reference document that you can follow: Output Fields
I work with firebase database, I have the following data,
I need to get all groups names (GName) of a user by his phoneNum, i.e. all groups of specific user, How can I get that in swift 4?
You should consider restructuring your data. If a user belongs to more than one group in your application then you'll probably have to duplicate your user node for every group the user belongs to in your data structure. You can create another JSON object that holds all of the groups that a user belongs to. Here is a sample JSON for you:
{
"users": [{
"xyz123": {
"userId": "xyz123",
"username": "user1",
"phoneNum": "123456",
"groups": [{
"groupId": 1,
"groupName": "aaa"
}, {
"groupId": 2,
"groupName": "bbb"
}]
}
}]
}
As for filtering with the phone number, you can get all users inside a list and filter the result with the phone number criteria
result = result.filter({item.phoneNum == "123456"})
or get phone number of the user to a upper level, call .child() method with the phone number criteria and fetch the specific user.
Also take a look at structuring data part at firebase documentation.
https://firebase.google.com/docs/database/ios/structure-data
Hope that helps.
I want to create a report regarding my App's rating in three dimensions - date, Country and App Version (I know that from Android I can get in a query only Date+Another Dim, not quite sure how it works with Apple...). I found the "Reporter" (https://help.apple.com/itc/appsreporterguide/#/itcbd9ed14ac) but it allows me only finance reports... I also saw the RSS option - only this option gives me the "last X reviews"' and I just want an aggregated data (lets say - for each day, how many 1 star rating, 2 star rating etc'...)
If someone can help me with how to do so (preferably in bash/python script), I'd really appriciate it. Thank you!
The easiest way to get them out of iTunes Connect is probably with Spaceship. (App > Activity > Ratings & Reviews
# Get reviews for a given store front
reviews = ratings.reviews("US") # => Array of hashes representing review data
https://github.com/fastlane/fastlane/blob/master/spaceship/docs/iTunesConnect.md#app-ratings--reviews
The Appfigures API can give you ratings and reviews for iOS and Android apps.
The following request will give you the last 50 reviews from any country, but you can easily get more reviews, limit by country/version/etc.
GET https://api.appfigures.com/v2/reviews?count=50
While will give you something like this:
{
"total": 140,
"pages": 28,
"this_page": 1,
"reviews": [{
"author": "DeveloperToDeveloper",
"title": "Just Spectacular",
"review": "Finally able to remove the ads! The description is hilarious!! Thanks!!!",
"original_title": null,
"original_review": null,
"stars": "5.00",
"iso": "US",
"version": "1.2",
"date": "2017-05-19T17:05:00",
"product": 6567539,
"weight": 0,
"id": "5561747L7xnbsMRu8UbPvy7A71Dv6A=="
}]
}
Here's how you'd do it with Python:
import requests
USERNAME = 'USERNAME'
PASSWORD = 'PASSWORD'
APP_KEY = 'APP_KEY'
BASE_URI = "https://api.appfigures.com/v2/"
# Helper function for auth and app_key
# first / in uri is optional
def make_request(uri, **querystring_params):
headers = {"X-Client-Key": APP_KEY}
auth =(USERNAME, PASSWORD)
return requests.get(BASE_URI + uri.lstrip("/"),
auth=auth,
params=querystring_params,
headers=headers)
# Get the last 50 reviews for all of our apps
reviews_response = make_request("/reviews",
count=50)
assert 200 == reviews_response.status_code
assert 0 < len(reviews_response.json())
# Use the response to sum up ratings, analyze review text, etc.
FYI - Reviews and ratings are separate for apps, and while the 5 star rating on a review contributes to the total rating, there could also be ratings that aren't associated with a written review.
Those can be retrieved using the Ratings route.
I'm converting model query results to json and send them to selection box with
MyModel.find(params[:id]).my_sub_models.map(&:attributes)
I'm displaying my_sub_model :name(s) in selection box. Thats ok.
Later i added a column(:label) to sub model and i want to display a combined text in selection box like :name-:label. So i created a method
def combined_name
self.name + "-" + self.label
end
How can i add combine_name for each item into my json now?
Any idea? Thanks
To include any methods on the model, use :methods.
my_model.to_json(:methods => :combined_name)
# => {"id": 1, "name": "My Name", "label": "Label",
"created_at": "2012/02/01", "combined_name": "My Name - Label"}
Reference: API Doc.
Update:
to_json method of ActiveRecord was deprecated after 2.3.8. You probably are using Rails 3. A similar question was asked sometime back here and the responses might help you here. Especially about the gem acts_as_api. Do check.
Have u tried collect?
MyModel.find(params[:id]).my_sub_models.collect { |sub_model| [ submodel.id, submodel.combined_name ] }
This way you will send only id and the name, that you will need for your select box.