I am currently having a problem with getting the correct time for an event via Facebook's graph API. There are some events showing the correct time and some are not. Even if I am calculating the timezone wrongly, it just doesn't make sense to me.
For example I have the following three events: "Brunch", "Champions league finale" and "Pfingst-Tanz". That's what the graph API gives back:
{
"data": [
{
"name": "Pfingst-Tanz",
"start_time": "2012-05-27T10:00:00",
"end_time": "2012-05-27T14:00:00",
"timezone": "Europe/Berlin",
"location": "...",
"id": "..."
},
{
"name": "Championsleague Finale",
"start_time": "2012-05-19T11:45:00",
"end_time": "2012-05-19T14:45:00",
"timezone": "Europe/Berlin",
"location": "...",
"id": "..."
},
{
"name": "Muttertagsbrunch",
"start_time": "2012-05-13T10:00:00",
"end_time": "2012-05-13T14:00:00",
"location": "...",
"id": "..."
}
],
"paging": { … }
}
On the Facebook page it shows:
Pfingst-Tanz 19:00 (07:00 pm)
Champions league finale 20:45 (8:45 pm)
Brunch 10:00 (10:00 am)
Which results in:
Pfingst-Tanz: Facebook page correct, API incorrect or TZ incorrect in my app
(Champions league finale: don't know, never mind)
Brunch: Facebook page and API correct and same
This just does not correspond to each other. From what I understand it has to be either all wrong or none wrong, but not just 1/3 or 2/3 events. Does anyone have an idea, or am I just too blind to see something?
Your "Brunch" event doesn't include a time zone, so it can't be adjusted to the user's local time zone, which is what I assume Facebook is doing.
It's not immediately clear to me whether the start_time and end_time values are meant to represent the local start/end times (in the given time zone) or the UTC start/end times, but that should be easy enough to work out based on the data (and documentation, hopefully). I suspect it's the UTC start/end when there's a time zone specified, but the local start/end otherwise.
Related
Since mid of last week I witnessed increasing issues with the events list query params for upper and lower bounds. Since the weekend it is no longer working at all.
Issue summary:
Positive timezone offsets no longer accepted in events list query params for time bounds.
Api call:
GET https://www.googleapis.com/calendar/v3/calendars/<myCalendarId>/events
with query params: ?timeMin=2020-12-01T09:31:04+0100
Expected behavior and behavior until around Nov 25th, on some servers until Nov 27th:
{
"kind": "calendar#events",
"etag": "\"blahblah\"",
"summary": "blahblah",
"updated": "2020-12-01T07:46:56.357Z",
"timeZone": "Europe/Berlin",
"accessRole": "owner",
"defaultReminders": [
{
"method": "popup",
"minutes": 30
}
],
"nextSyncToken": "blahblah",
"items": [
...
Actual behavior / response body:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "badRequest",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
Further details:
Apparently the "bad request" response is solely induced by the plus (+) symbol before the time zone offset. Changing the "+" to a "-" in the above request will return a valid response as expected only that the offset is wrong (in this case by two hours as it should be).
Writing the offset with or without ":" (e.g. +01:00 vs +0100) does not affect results.
Most likely I have missed something like a depreciation of positive time zone offsets or I was anyway using a wrong time format since I am admittedly not an expert in the RFC3339.
The other option is that the Google calendar team has updated their parser in their calendar API and in the wake of that deployed a bug. In that case a test case should be added to the pipeline for testing several time zone offsets including the limits.
I would be happy to receive advice on how to gracefully select and time zone east of UTC.
Thanks a lot in advance!
There is no such deprecation, but when you make an HTTP request you need to URL encode the parameters
Sample:
https://www.googleapis.com/calendar/v3/calendars/primary/events?q=timeMin%3D2020-12-01T09%3A31%3A04%2B0100
The following JSON is sent, as the “attachments” argument, in a call to the chat.postMessage API method. The message is posted to an individual user (not a shared channel) and per documentation I was expecting the timestamps to be displayed in the target user’s local timezone. Instead they are always displayed in UTC, so am I doing something wrong?
[
{
"mrkdwn_in": [
"text"
],
"title": "Important alert",
"footer": "MyCodeThing",
"fallback": "Important alert summary",
"text": "A thing with a date just happened <!date^1475148495^{date_short_pretty} at {time}|Sep 29 at 09:28 PM UTC>\n\nUsers Name from *Company & Associates*",
"fields": [
{
"short": false,
"title": "",
"value": ""
},
{
"short": false,
"title": "Device",
"value": "Using Chrome on Other."
}
],
"footer_icon": "https://anysite.domain.com/static/img/image_only_16.png",
"color": "#f54b0a"
}
]
It looks to me as though it completely ignores the timezone in the preferences, and it shows the time in the current timezone for the PC it is running on. Which, in my case, is UTC. I can change the timezone preference in slack to whatever I want, but it comes up UTC on the computer where I have this problem.
I can use the same account, open the same chat history on another PC, and it shows it in the correct time according to that PC's OS.
This is in the app, not the browser version. I don't know the behavior of the browser version.
I have retrieved a json object using typhoeus gem.
url = 'www.example.com' <br>
request = ::Typhoeus::Request.get(url,userpwd: username + ":" + pass)<br>
content = JSON.parse(request.body)
I would like to count the occurence of "Priority":"high" including the quotes inside the json response. How do I go about doing this?
Edit:
"priority":"high" is a key value pair. It is deeply nested inside the json tree.(Don't how deeply it is nested). All I need is count of occurence of "priority":"high"
Any and all suggestion is welcome.
Sample data:
"tickets": [{
"url": "https://.zendesk.com/api/v2/tickets/xxxx.json",
"id": xxxxx,
"external_id": null,
"via": {
"channel": "email",
"source": {
"from": {
"address": "#compli.com",
"name": ""
},
"to": {
"name": "organization Global Support",
"address": "support#organization.zendesk.com"
},
"rel": null
}
},
"created_at": "2016-08-04T16:23:13Z",
"updated_at": "2016-08-08T20:26:01Z",
"type": "problem",
"subject": "Problems with abc Connect",
"raw_subject": "Problems with abc Connect",
"description": "Hi – our Tenet ID is 5675.\n\n \n\nThe abc report is not providing the full data when I run the billing preview. I am running it using Chrome. Attached are snapshots of what I’m doing plus the report generated.\n\n \n\nA perfect example of the problem is shown at the bottom of the report generated. Garber Automotive Group, account number A00000490 does not display the data for all of their products. Their data is shown on rows 5658 thru 5712 on the excel file BillingPreviewResult_201620 report run 08.04.16.\n\n \n\nHowever the EXACT same report (all the parameters are the same) run on 07/01/16 included all of Garber’s information. The excel file abc report run 07.01.16 10.13 AM has the data for Garber on rows 6099 – 6182.\n\n \n\nThe report is cutting off a lot of data for some reason. As you can see by comparing the amount of data between the two excel reports there are much fewer lines on the report run on today as opposed to the one run on 07/01, 6182 rows vs 5712 rows.\n\n \n\nThis is a business critical report for us. It is used for cash forecasting, monthly financial reporting, rolling budgeting and ad hoc reporting.\n\n \n\nWe need this problem identified and fixed immediately. It is already causing a problem with finalizing our July results.\n\n \n\nLet me know if you have any questions or need any additional data.\n\n \n\n \n\nRegards,\n\n \n\n \n\n \n\n| Controller\ndesk: 503.963-4239 | fax: 503.294.1200 | \n\nCompli - Cool, Calm and Compliant. TM\n\nVisit() to learn more.\n\n \n\nFollow us on LinkedIn () and Twitter",
"priority": "normal",
"status": "open",
"recipient": "support#organization.zendesk.com",
"requester_id": 1336424406,
"submitter_id": 1336424406,
"assignee_id": null,
"organization_id": 224504969,
"group_id": 21606503,
"collaborator_ids": [560973773, 786229209, 421597631, 539566717, 707192615, 1336424406, 31365392, 719608577, 1817633993],
"forum_topic_id": null,
"problem_id": null,
"has_incidents": false,
"due_at": null,
"tags": ["1_price", "best_practice_advise", "engage_global_services__email_", "escalate", "hard", "internal_escalation", "p0", "yes_escalated", "xxxxx", "zhub"],
"custom_fields": [{
"id": 22024091,
"value": "p0"
}, {
"id": 24212576,
"value": "best_practice_advise"
}, {
"id": 22035048,
"value": "xxx and so on.....
I have been noticing that sometimes the response to an event search returns an event that is outside of the date range in the que3. Here is an example (with my key removed):
http://www.eventbrite.com/json/event_search?app_key=mykey&keywords=Photography&max=10&latitude=34.19751&longitude=-119.1771&within=50&within_unit=K&date=2012-07-20%202012-07-22
Here are the parameters, one per line:
http://www.eventbrite.com/json/event_search
?app_key=mykey
&keywords=Photography
&max=10
&latitude=34.19751
&longitude=-119.1771
&within=50
&within_unit=K
&date=2012-07-20%202012-07-22
If I run this query, I get 3 events, one of which looks like this (with some items shortened for brevity):
"event": {
"box_header_text_color": "005580",
"link_color": "EE6600",
"box_background_color": "FFFFFF",
"timezone": "US/Pacific",
"box_border_color": "D5D5D3",
"logo": "http://...",
"organizer": {
"url": "http://...,
"id": 1066754373,
"name": "Red Brick Gallery"
},
"background_color": "FFFFFF",
"id": 2667310999,
"category": "seminars,entertainment",
"box_header_background_color": "EFEFEF",
"capacity": 8,
"num_attendee_rows": 9,
"title": "Copy of Watercolor Workshops with Joe Cibere",
"start_date": "2011-07-23 14:00:00",
"status": "Started",
"description": "...",
"end_date": "2012-06-16 17:00:00",
"tags": "...",
"text_color": "005580",
"repeat_schedule": "custom-2659333",
"title_text_color": "", ...
I use the keys (under "event") "start_date" and "end_date" to identify the event dates, which spans from 2011-07-23 to 2012-06-16.
The query spans from 2012-07-20 to 2012-07-22.
The date span of the event and the date span of the query don't overlap.
Am I doing something wrong with my query, or is the response incorrect?
Although this event is scheduled to end on '2012-06-16', it is configured to repeat on various dates in the future. See the "repeats" and "repeat_schedule" attributes for more information.
We recently added support for allowing you to access the array of 'start_date' and 'end_date' pairs (per each repeating instance).
The additional response output should be included any time you add a "display" parameter with a value of "repeat_schedule" to the event_get, event_search, user_list_events, or organizer_list_events API calls.
I'm trying to find a way to just get tweets to all users. The JSON code indicates these as "to_user" null. For example the tweet below edent tweets to everyone, thus the to_user=null.
I tried a few alternatives without success:
http://search.twitter.com/search.json?q=to:null%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:0%20from:edent&result_type=mixed
http://search.twitter.com/search.json?q=to:%20from:edent&result_type=mixed
{
"created_at": "Thu, 28 Jun 2012 06:55:58 +0000",
"from_user": "edent",
"from_user_id": 14054507,
"from_user_id_str": "14054507",
"from_user_name": "Terence Eden",
"geo": null,
"id": 218236278402068480,
"id_str": "218236278402068480",
"iso_language_code": "en",
"metadata": {
"result_type": "recent"
},
"profile_image_url": "http://a0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"profile_image_url_https": "https://si0.twimg.com/profile_images/2318692719/7182974111_ec8e1fb46f_s_normal.jpg",
"source": "<a href="http://twitter.com/">web</a>",
"text": "RT #straczynski: #edent Clearly the man was ahead of his time.",
"to_user": null,
"to_user_id": 0,
"to_user_id_str": "0",
"to_user_name": null,
"in_reply_to_status_id": 218075066452287500,
"in_reply_to_status_id_str": "218075066452287488"
},
If you're just looking to get tweets from a particular user that aren't to anyone, use the /get/statuses/user_timeline REST API endpoint instead of the Search API. /get/statuses/user_timeline has an exclude_replies parameter that should do what you're looking for.
The Search API doesn't have any way to exclude replies. Your only option is to get tweets matching whatever other parameters you pass, and process them on your end to remove any whose text starts with "#".