Does Google Calendar API provide an endpoint for getting all of the meeting invites that a given user has yet to respond to? I'm familiar with the responseStatus field in the Event API so one way I imagine doing this is simply looking through all events on the calendar for which responseStatus == 'needsAction' but I'm hoping there's an easier way.
Any suggestions much appreciated!
I think the only way to do this is to get the Event and loop through the attendees to check the status. You can give that a try here, so you can immediately see the results.
Related
Say, I have the api api.example.com, and it has a page under api.example.com/view/${id} that takes an id and returns json data like so:
{
title: "foobar",
id: 34102
}
The api does not have a search page.
The possible ids starts from 00001 to 99999. How can I search for "foobar" and get back 34102?
The only option I can think of is storing all that data through web scraping then searching in it. But sending 100000 requests would most likely get my IP banned.
Thanks.
I haven't tried anything yet.
Unfortunately if the website providing the API does not also provide an API with a keyword search, you won't be able to find it by that parameter. They are their API routes and they can handle the logic and parameters as they choose, so if they don't want you searching by a title, you're out of luck.
Keep in mind that your alternative solution is not something that you should do -- You should not hit someone's API with 1k+ requests.
I tried to get the event from Google Calendar of the specific date
function testing(){
var cal = CalendarApp.getCalendarById('moses#gmail.com');
var events = cal.getEvents(new Date("7/11/2022 07:30 AM"),new Date("7/12/2022 10:00 AM"));
for (var i=0;i<events.length;i++){
var title = events[i].getTitle();
var start_time = events[i].getStartTime();
var end_time = events[i].getEndTime();
}}
But I don't know how to get the same detail from Calendar when I schedule any meeting without specifying any date range.
My request is, I need to get the Title, Organizer Name, Start and End Time of the meeting when I schedule any meeting in Google Calendar.
Moment I press Save in the Calendar, My script needs to trigger and get the details of the meeting I scheduled in calendar.
This can get complicated and you won't be able to only use Google Apps Script for it.
I believe your question boils down to two requirements:
Knowing when a new event has been created.
Getting the details of this newly created event to use as you see fit.
For #1, you can know when a calendar gets modified by using push notifications. The way this works is that you send a POST request to the Calendar's watch endpoint, with headers specifying the URL of a server that you want to set up as a webhook. This server will receive POST notifications when the Calendar gets updated and you can then handle them. A few caveats:
There are no native Apps Script functions that can use this, so you need to create your own GCP project, and generate the Authorization token to include in your request to create the webhook.
You will need to set up your own server to handle the callbacks. You cannot use Apps Script as a Web App because the callbacks contain all their information in their HTTP headers, and the doPost() method does not contain the headers, as explained in this question. Since the notifications work by sending POST messages, Apps Script won't work here.
The notifications are not 100% reliable. A small percentage of messages may get dropped so you won't always know that there was a change.
As for #2, the problem here is that the push notifications are only meant to notify your app that a change was made so it can handle the syncing on its own. This means that they don't include any details about what exactly changed, so you cannot know which event was created or changed, you only know that the calendar was somehow changed, and it's up to you to figure out what it was.
Google recommends using incremental sync, which means that you first sync all events, then use the syncToken they provide to get only changed events. You can use this to figure out which events changed since you got the notification, but you may have to refresh a full sync sometimes, so rather than just picking up new events, your app is now in charge of fully syncing the Calendar.
If this is all too much work you can still try to list events using the updatedMin parameter to only list events more recently modified than a specific date/time. You can use this with Apps Script's Advanced Calendar Service. You could do this periodically, but you won't have the instant trigger you're looking for.
Sources
Node.js sample of how to use webhooks
Push Notifications
Advanced Calendar Service
Synchronizing calendars
I needed to submit an approved-account access to Unsplash API, so as to access certain links for access approval. Given that the replies from the support team has taken more than a few days, I would just like to seek out additional help to resolve in retrieving the access_token for new requests-submissions via GET / POST methods.
The original website was working perfectly, till when I had wanted to get ready for submission for production stage and had wanted to prepare potential increases in requests to the Unsplash API.
However, the approval process entailed certain setup criterial, which I totally missed during my development phase and sought to iron out as soon as possible. One of the key component is to resolve your UTM links, which you may find here as the ideal reference: https://help.unsplash.com/en/articles/2511315-guideline-attribution.
My challenge then was that I had attempted to use the official javascript API, Unsplash-Javascript-API (https://github.com/unsplash/unsplash-js#authorization), in an effort to make the authentication / request processes simpler for my webapp to call.
Though most GET requests do work, given that a specific URL of links via "download_location" (https://help.unsplash.com/en/articles/2511258-guideline-triggering-a-download), has to be used instead, it will then require an authenticated request per new submission request by the webapp.
The final challenge then is that apparently it is not clear how the official Unsplash-Javascript-API actually pulls the "authenticated" request, as I was unable to find it on the website, so that I may retrieve the current-access_token for requests' usage.
The basic codes I am using via the API is the following, however I am confused what is the actual maximum request I may pull per page, I am hoping to get 100 returned images' details, but only gotten a maximum of 30 per time. Anyone can also help to confirm is there a workaround to increase this 30 to 100?
Retrieving a Collection of Photos
unsplash.collections.getCollectionPhotos(urlAPI, 1, 100, "Popular")
.then(toJson)
.then(jsonData => {
console.log("jsonData", jsonData);
});
So, currently my website is unable to launch for nearly 1 week plus, as I am just awaiting the final confirmation or additional help from the customer support end of the official Unsplash Team.
Hopeful that someone may help to assist me in clarifying the codes so that at least I can get one step closer to sorting this "official authenticated" process out, and take away one lesser step to getting my approval access for production ready.
Thank you in advance!
Given multiple tries. I wasn't able to retrieve the Access_Token reply, given that there is a pre-authorization step that I wasn't able to find any working solution to.
The current and clear limitations to the API are:
Maximum of 30 images request per GET request.
The official javascript API, Unsplash-Javascript-API (https://github.com/unsplash/unsplash-js#authorization) works but there is not clear or easy way to retrieve the "Access_Token" for a session usage.
Multiple async AXIOS / FETCH requests may not be "compiled successfully" when using ReactJS ContextProvider function prior to the first render. Therefore, an empty array will be shown instead on the final initial render.
Ultimately, my chosen solution is current to break down the images list to the most priority, with the limitation of only 30 images on retrieval, and still store into the original collection and retrieve it.
The other alternative is to actually download and load the images to your own server to load it, which may also be a faster route.
Sadly enough, the Unsplash API team doesn't response as frequently to assistance and my last contact was roughly 1 month ago, though I have attempted to update to their requirements but there were no feedback thereafter.
Thus, it will tentatively be better for you to just build an alternative solution than to rely on the team for a feedback, unless you are a paying client.
Good luck to the others on this! Cheers!
I have modified the script found here Retrieve Google Calendar events using API v3 in javascript to display a page of upcoming events over the next 30 days which summarizes each event.
I would like to create a link provided with each event summary on the above page to another page that would show more details for a specific single event.
I cannot seem to write the code that will successfully take the eventId and query the Google Calendar API to retrieve the resources for that single event.
I apologize in advance as I am trying to learn Javascript as I go so I suspect this is something rather simple that I'm stuck on.
I am of the belief that in the makeApiCall() function I would desire to change the lines that start with:
var request = gapi.client.calendar.events.list({
to:
gapi.client.load('calendar', 'v3', function () {
var request = gapi.client.calendar.events.get({
'calendarId' : userEmail,
'eventId': eventIDstr});
I can get a valid answer when using Google's APIs Explorer pages so I know I have the correct Calendar and Event IDs. Just cannot seem to apply that to the correct javascript to get the results I am looking for.
I have searched high and low for samples of javascript that will retrieve a single Event's data from Google Calendar using v3 of their API and have come up with nothing useful. Any help would be greatly appreciated.
Thanks in advance.
Yes, you're on the right path. Use Events:get. Events provides different flavors of event resources.
HTTP request
GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId
If successful, method returns an event resource in the response body.
import com.google.api.services.calendar.Calendar;
import com.google.api.services.calendar.model.Event;
// ...
// Initialize Calendar service with valid OAuth credentials
Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials)
.setApplicationName("applicationName").build();
// Retrieve an event
Event event = service.events().get('primary', "eventId").execute();
System.out.println(event.getSummary());
You can use singleEvents=true parameter in the list request to avoid the second call. This will ask the server to do the recurring event expansion for you right away.
Using Facebook's JavaScript API I can get my event and the rsvp status of all the attendees.
What I'd like to get is information on who checked into the event, or updated their status to say they were at the event.
Status of person at my event: http://note.io/1maQlip
From what I can tell, I need to loop through the users checkins to see if they were at my event. It doesn't seem like I can query the event for all the users that checked in. Is that true?
Yes, I'm afraid there's no other options than looping through the users' checkins for the moment : /
PS: #Tobi, this will return the list of attendees, not the list of users who checked in at the event (sorry, had to include this in my answer as I can't comment yet).
You can use the FQL table event_member to query for
https://developers.facebook.com/docs/reference/fql/event_member/
An FQl query for you event is
https://graph.facebook.com/fql?q=select+uid,+rsvp_status+from+event_member+where+eid=599978450080176&access_token={ACCESS_TOKEN}
You can use it via the JS SDK like this:
FB.api('https://graph.facebook.com/fql?q=select+uid,+rsvp_status+from+event_member+where+eid=599978450080176&access_token=' + access_token');
What you can't do without having the User's user_checkins permission is to crawl for everybody who checked in you Event, which you'd need to gather via an App.