YQL Console working inconsistently - yql

I'm trying to make a finance app that, for now, pulls stock quotes. My problem is detailed below:
On the developer's console (http://developer.yahoo.com/yql/console/), I will click "show community tables" on the right under "Data Tables"
I type in 'select * from yahoo.finance.quotes where symbol="YHOO" ' for my YQL statement
I click the JSON radio button
I erase "cbfunc" and uncheck the Diagnostic checkbox
I click "test" and what I want to appear appears: { "query": { "count": 1, "created": "2012-12-03T09:11:12Z", "lang": "en-US", "results": { "quote": { "symbol": "YHOO", "Ask": null, ... etc
Under "The Rest Query", it gives me a link that I can use to access what is displayed. That link, which my program calls, does not work. It shows {"query":{"count":0,"created":"2012-12-03T09:12:44Z","lang":"en-US","results":null}} instead, but not always - sometimes it works and sometimes it doesn't.
Does anyone know why?

It's possible that you are running into a rate-limit problem.
I would enable the Diagnostics option - that will include in the output details of the calls made by YQL and whether any returned data. Here's a YQL Console link to your sample query, with diagnostics enabled:
select * from yahoo.finance.quotes where symbol="YHOO"

Related

Google Home SYNC and ReportState "online" values don't seem to be read by iOS client but Android is OK

Problem
When fulfilling SYNC requests, QUERY requests and ReportState calls, I'm reporting all devices as "online": true. I can see this value being correctly read by Google, in that the values appear set on the ReportState Dashboard test tool. Android works fine, showing the device online ("Linked to you") after a brief query ("Connecting..."). Converesly, when using the iOS mobile client, as the user goes into the page for a device, it queries only to then report the device as being offline. Both the dashboard and JSON responses to calls all show "online": true. If the user tries interacting with the device, for example turning it on, it works.
QUERY Response
{
"requestId": "ARequestId",
"payload": {
"devices": [{
"id": "ADeviceId",
"online": true,
"status": "SUCCESS"
}]
}
}
Notes
This could be a bug in the iOS client, but it seems much more likely it's a bug in my code or misunderstanding on my part as this is my first Smart Home Action.
I've tried including "online": true all over the place, e.g. in SYNC, QUERY and ReportState calls. This has at least given the dashboard awareness of the initial online state, but not helped the iOS client.
In general, ReportState seems to work fine, in that my changes are reflected in the dashboard.
Screenshots
Note the contradiction between the test tool's state and the iOS client's indication.
ReportState Dashboard showing online=true
iOS Google Home Client showing same device as offline
I came back to this issue after around a year away from this project. It turns out that this is actually due to misreading the response structure of the QUERY Intent. The SYNC Intent expects an array of objects with "id" fields. The QUERY Intent expects a dictionary keyed by the id.
Bizarrely, even though this is back-end to back-end, and no error is thrown by the Google side, an Android client seems to handle this fine, but the iOS client doesn't.
Essentially, yes there is a bug there somewhere with iOS in as much as it ought to behave the same as Android, and similarly there ought to be a 400 error for the bad request format, but the error was essentially in my response structure.
A Correct SYNC Intent Response
[
{
"id": "DeviceId1",
"online": true,
"status": "SUCCESS"
},
{
"id": "DeviceId2",
"online": true,
"status": "SUCCESS"
}
]
My Erroneous QUERY Intent Response (Same as correct SYNC)
[
{
"id": "DeviceId1",
"online": true,
"status": "SUCCESS"
},
{
"id": "DeviceId2",
"online": true,
"status": "SUCCESS"
}
]
A Correct QUERY Intent Response (a keyed dictionary, rather than an array)
{
"DeviceId1" :
{
"online": true,
"status": "SUCCESS"
},
"DeviceId2" :
{
"online": true,
"status": "SUCCESS"
}
}
So even though the emergent behaviour was different in iOS and Android, it was me all along. It was a very easy to miss slip. Hope this helps someone, as the lack of errors coming back meant this one was infuriating.

/beta MS Graph /sites/lists lastModifiedDateTime is wrong?

Using MS Graph API /beta endpoint to figure out if the list has been updated/changed.
Used the following query first:
https://graph.microsoft.com/beta/sites/xxxxx.sharepoint.com:/sites/xxxxx?$expand=lists(select=id, name, system, lastModifiedDateTime)
And did get the following date:
"lastModifiedDateTime": "2018-10-08T10:23:37Z",
But when going against the items and see the dates on the latest item with the following query:
https://graph.microsoft.com/beta/sites/xxxxx.sharepoint.com,92af4fbc-04bc-46d8-9c78-f63832fbf48a,1b59d85a-41bd-4498-a64c-17bd13069d90/lists/b9c39323-076a-4ae7-942b-1d0060a6b352/items
you can see the dates:
"createdDateTime": "2018-10-08T10:23:37Z"
"lastModifiedDateTime": "2018-10-08T10:29:14Z",
You can see that lastModifiedDateTime property on the list looks like actually lastCreatedDateTime?
Best Regards,
Kim
edit:
First graph request gets the SitePages list and its lastModifiedDateTime:
{
"id": "b9c39323-076a-4ae7-942b-1d0060a6b352",
"lastModifiedDateTime": "2018-10-08T10:23:37Z",
"name": "SitePages",
"system": {}
},
But if we then look at the items of the list, we can see that it has an item with a higher lastModifiedDateTime (second graph request):
"createdDateTime": "2018-10-08T10:23:37Z",
"eTag": "\"27e03a98-9321-4586-8ef1-0b5323c26730,6\"",
"id": "8",
"lastModifiedDateTime": "2018-10-08T10:29:14Z",
We can also see that the createdDateTime of the listitem is the same as the list lastModifiedDateTime. Looks like a bug in the api to mee. The date in the first request should be "2018-10-08T10:29:14Z". Dont you agree?
As your description, I assume you want to know why the LastModifyDateTime is different.
Base on my test, your first link is to get the lastModifyDateTime of the special site,
but your second link is about the items of the b9c39....
We can use the MS Graph Explore to check whether this two site has some differences.
Indeed, it appears to be a bug, for List resource lastModifiedDateTime property returns invalid value, it seems to be mapped to the last list item date and time when the item was created (ListItem.createdDateTime)
It could also be confirmed as a bug using the following endpoints (in both examples a valid lastModifiedDateTime value is returned):
https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/drive/root?select=lastModifiedDateTime
https://tenant.sharepoint.com/_api/web/lists/getbyid({list-id})?$select=LastItemModifiedDate
Meanwhile as a workaround the following solution could be considered to enumerate site lists:
https://graph.microsoft.com/beta/sites/{site-id}/drives?expand=root(select=lastModifiedDateTime)
where root/lastModifiedDateTime returns a valid value
Limitation: Only returns document libraries

fetching json data using yql from yahoo finance.quotes is not working from 01/11/2017 22:00

I am getting an empty result from yahoo finance when i use the api to table yahoo.finance.quotes
I used your query to check the interface and the result is NULL. Apparently there is a malfunction.
steps for testing:
go to https://developer.yahoo.com/yql/console/
show community tables
Mark checkbox: show community tables
uncheck: DIAGNOSTICS
Select a table: finance.quotes
A default query will appear
select * from yahoo.finance.quotes where symbol in ("YHOO","AAPL","GOOG","MSFT")
The result
{
"query": {
"count": 0,
"created": "2017-11-02T13:21:01Z",
"lang": "en-US",
"results": null
}
}
Very sadly and quite outrageously Yahoo decided to stop this service without any warning.
See admin message here
So many services depend on it, it's like Google saying they would suddenly stop their maps API... At this point I am blocking yahoo in our DNS so no one in our company will ever use Yahoo again since they are not a reliable entity.

Get Recommendation from LinkedIn API returns empty map [:] as response

I have created a web application from which I am trying to get recommendations of a user from his/her LinkedIn Profile using URL
String url="https://api.linkedin.com/v1/people/~:(recommendations-received:(id,recommendation-type,recommendation-text,recommender))?format=json"
When I am using this URL in the
Api Explorer it works fine. And gives output:-
{ "recommendationsReceived": {
"_total": 2,
"values": [
{
"id": 558598601,
"recommendationText": "xxx is among the best team players I ever worked with. He has handled client effectively with smooth operations. I had always seen him as person with solution mindset and always look for solution rather than thinking about the problem. ",
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXX"
}
},
{
"id": ZZZZ,
"recommendationText": "XXX is one of the most dedicated person at work.I always him with a flexible attitude and ready to adapt himself in all situation.I have seen him work all night to catch up all the deadlines and deliver on time ."
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXXX"
}
}
] } }
The problem comes, when I am using this URL in my Developer app.It doesn't give any error just simple return an empty map [:] as output in response
Irrespective of these recommendation fields, I successfully get the user basic profile data such as email, id, image,firstName,lastName.Means my code is working for other fields well but not for these recommendation fields*
To find the solution, I did some internet surfing and find a link of Linked API docs
Linked API Docs
As per Docs following selection of profile fields are only available
to applications that have applied and been approved for the Apply with
LinkedIn program:
Recommendation Fields
I already created a LinkedIn Developer account to get key & Secret
So how do I apply and get approval for Apply with LinkedIn Recommendation Fields.
I already have seen the LinkedIn support but can't find the way to ask question to the Linked Developer help support
Please suggest me the right way.
After a long internet surfing,I have found something fruitful that, I have to fill up a form to get these fields.Here is the form
along with its procedural details
You can use just recommendations-received keyword. Try the following link. I am getting all recommendations details with this link.
https://api.linkedin.com/v1/people/~:(recommendations-received)?format=json

How to split Slack messages from same user?

I'm using the Slack API to post automatic messages with various statuses. To mark the status, I use emoji icons. Sending works fine, and the right icon is set (I see it in the response), but subsequent posts are running together in the channel, so even if even if the icon is different, it does not show until there is a message from another user in between:
[red icon] BOT_USER msg #1 some info - status critical
msg #2 some info - status ok (should have green icon!)
msg #3 some info - status critical
[user icon] SOME_USER some message
[green icon] BOT_USER msg #4 some info - status ok
(sorry, not enough rep to post a screenshot)
Is there a way to split the messages, ensuring the icon is always displayed? If not, is there a way to e.g. change a message's background color?
I found the way to mark it using the attachments. My script looks like that (quoting gave me some headache):
ATTACHMENTS="[{\"fallback\":\"$INPUT\",\"text\":\"$INPUT\",\"color\":\"$COLOR\"}]"
curl -sS -X POST \
--data "token=$TOKEN&channel=$CHANNEL_ID&username=$FROM&attachments=$ATTACHMENTS" \
https://slack.com/api/chat.postMessage
Setting the $COLOR variable to danger, good, or a hex color, provides a vertical bar of that color next to the message, which works for me. So, even if the messages get grouped by user, the bars provide distinction.
The grouping of message from the same user is standard behavior from Slack and can not be changed. So it makes sense not to use the icon and name of a user as indicator, but instead look for other approaches.
Colors in attachments is one alternative approach. Another is to use thumbnails in attachment (instead of user icons).
Instead of text, u can utilize blocks & blocks of type divider can be used before & after a message.
"blocks": [
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "This is unquoted text\n>This is quoted text\n>This is still quoted text\nThis is unquoted text again"
}
},
{
"type": "divider"
}
]

Resources