Can't receive images by hashtag - instagram-api

I'm trying to get all images with a specific tag by Instagram API.
First I send this request:
https://api.instagram.com/v1/tags/tag?access_token=XXXX
and get response:
{
"meta": {
"code": 200
},
"data": {
"media_count": 8215885,
"name": "tag"
}
}
Then I try to start receive an images by next request:
https://api.instagram.com/v1/tags/tag/media/recent?access_token=XXXX
Result is:
{
"pagination": {
"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"
},
"meta": {
"code": 200
},
"data": []
}
Why data is empty?
I tried to send this request by adding count parameter, result was the same. I think maybe
min_tag_id or max_tag_id is required, but I don't know where I can get it.

Trouble was in sandbox mode. Without LIVE mode app can receive only media that belongs to it's sandbox users. Answered here: New Instagram API - How do you request tagged media?

Related

"webUrl" coming as null when sending an file invitation - Graph API (Send a sharing invitation)

I'm Using an invite API from MS GRAPH - Invite LINK
Send a sharing invitation – External users
POST /me/drive/items/{item-id}/invite
POST /sites/{siteId}/drive/items/{itemId}/invite
The responses from the above request returns 200 OK response code and a permission object is returned , but the Sharing link(webUrl) under the link object returns “null” most of the times due to which the shareable link cannot be shared to External user for editing the document.
REQUEST BODY:
{
"recipients": [
{
"email": "abc#abc.com"
}
],
"message": "Here's the file that we're collaborating on.",
"requireSignIn": true,
"sendInvitation": false,
"roles": [ "write" ]
}
Here i don't want to share the item throgh mail hence making sendInvitation false and using the webURL recevied from response for collaboration.
Observation :
It works with gmail and outlook account.
For business accounts it's not working receiving url as null.
Samples:
If i invite for the first time , i'm getting below response ,
Sample Excepted Response:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
"value": [
{
"#odata.type": "#microsoft.graph.permission",
"roles": [
"write"
],
"grantedToIdentities": [
{
"user": {
"email": "##########.com"
}
}
],
"invitation": {
"signInRequired": true
},
"link": {
"type": "edit",
"webUrl": "https://**********encryptedURL*****/"
}
}
]
}
From the second time link object not coming in the response,
Sample Response Received Without webURL:
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(permission)",
"value": [
{
"#odata.type": "#microsoft.graph.permission",
"id": "###############",
"roles": [
"write"
],
"grantedTo": {
"user": {
"email": "#############.com",
"id": "#############",
"displayName": "#######"
}
}
}
]
}
i resolved my problem by using the upload API LINK
, once upload is successful the API returns response which will have "webUrl" link that can be used to share from second time.
(After exploring more with MS GRAPH API's observed that if we are
sharing the same file multiple times it will not give any new link as
the old link only can be used )
Actual Flow : Upload File -> Share File (this was happening everytime)
Changed Logic : First time : Upload File -> Share file
Second Time onwards : as file is already shared , using the url from upload API Response
As file is already shared with user for the first time hence the url which we are getting as response from UPLOAD API can be used , this url can be accessible by already shared user.
So i changed my logic if the user performing the operation for first time then i'm uploading file and sharing with him , if the user wants to perform same operation again instead of sharing the file again using the upload response url it works for me.
Posting this solution as it might help someone

How to edit a venue using the Foursquare API?

i'm using the Foursquare API in a project in order to manage venues informations through my app. Everything works fine, until I try to POST data to edit a venue details.
Actually, the post request seems to work fine, since a I get a 200 status code response. However I never see my changes on the platform. Here's the response I get :
{
"meta": {
"code": 200,
"requestId": "5d0a1b210d2be70039f03fc4"
},
"notifications": [
{
"type": "notificationTray",
"item": {
"unreadCount": 0
}
}
],
"response": {
"woes": []
}
}
Did any one succesfully used Foursquare API to edit venue details and then saw the changes on the platform ?
Thanks for your help !

Failed to parse Dialogflow response into AppResponse because of empty speech response for Ssml response

Trying to figure out the right Dialogflow fulfillment webhook json response.
The Json is being generated by .NET Core on AWS Lambda.
{
"fulfillmentText": "<speak><p>Welcome to Alterians News. I provide news that is of interest to Alterianss from a variety of sources, and on a variety of topics.</p> \r\n <p>You can say <emphasis>read</emphasis>, then the topic name. For example, you could say <emphasis>read today's news</emphasis>, or <emphasis>read <prosody rate=\"112%\">Banking and Finance</prosody> news</emphasis>.</p> \r\n <p>I cover the following Alterians news topics: house cats, Agriculture, \r\n <prosody rate=\"112%\">Banking and Finance</prosody>, Party Politics, <prosody rate=\"112%\">Police and Crime</prosody>, and the Military</p></speak>",
"fulfillmentMessages": null,
"source": null,
"payload": {
"google": {
"text": null,
"expectUserResponse": false,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": null,
"displayText": null,
"ssml": "<speak><p>Welcome to Alterians News. I provide news that is of interest to Alterianss from a variety of sources, and on a variety of topics.</p> \r\n <p>You can say <emphasis>read</emphasis>, then the topic name. For example, you could say <emphasis>read today's news</emphasis>, or <emphasis>read <prosody rate=\"112%\">Banking and Finance</prosody> news</emphasis>.</p> \r\n <p>I cover the following Alterians news topics: house cats, Agriculture, \r\n <prosody rate=\"112%\">Banking and Finance</prosody>, Party Politics, <prosody rate=\"112%\">Police and Crime</prosody>, and the Military</p></speak>"
}
}
]
},
"SystemItent": null
}
},
"outputContexts": null,
"followupEventInput": null
}
I have also tried this format:
{
"payload":
{
"google":
{
"expectUserResponse":true,
"richResponse":
{
"items":
[
{
"simpleResponse":
{
"textToSpeech":"<speak><p>Welcome to Alterian News. I provide news that is of interest to Alterians from a variety of sources, and on a variety of topics.</p></speak>"
}
}
]
}
}
}
}
The response from the actions on google Simulator was:
{
"responseMetadata": {
"status": {
"code": 10,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"#type": "type.googleapis.com/google.protobuf.Value",
"value": "{\"id\":\"f4fdf231-5316-454c-a969-6f36bd889d67\",\"timestamp\":\"2018-08-20T18:30:33.509Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":206,\"errorType\":\"partial_content\",\"errorDetails\":\"Webhook call failed. Error: 502 Bad Gateway\"},\"sessionId\":\"1534789833483\"}"
}
]
}
}
}
The Error Tab of the simulator has a lot of encoded Json but I believe the key information was:
Failed to parse Dialogflow response into AppResponse because of empty
speech response
Finally, the Errors Tab contained the following:
MalformedResponse 'final_response' must be set.
I have looked at the samples for the DialogFlow fulfillment webhook and tried to follow that.
There's comprehensive documentation of the Node.js client library, but not that much on the correct Json response formats that use Ssml.
Any help will be a appreciated.
Thanks
If you're sending back a reply to be used for the Assistant:
You can omit the fulfillmentText field.
Fields that are null should be omitted. Including fulfillmentMessages, and the SimpleResponse fields textToSpeech and displayText.

Instagram Tag Recent search always return null array

I wanna find specific tags media and these infos.
And, followed instagram API Document.
But, specific tags media API always returnd null array.
I tried this step.
Get a AccessToken
https://api.instagram.com/oauth/authorize/?client_id=[C_ID]&redirect_uri=http://localhost:3001/instagram/callback&response_type=token&scope=basic+public_content+relationships
Redirect And return accestoken
http://localhost:3001/instagram/callback#access_token=ACCESS_TOKEN
Find specific Tag(ex. snow)
https://api.instagram.com/v1/tags/snow?access_token=ACCESS_TOKEN
Returned,
{
"meta":
{
"code": ​200
},
"data":
{
"media_count": ​11664,
"name": "snow"
}
}
And Find Specific tag media list
https://api.instagram.com/v1/tags/snow/media/recent?access_token=ACCESS_TOKEN
Returned,
{
"pagination":
{
"deprecation_warning": "next_max_id and min_id are deprecated for this endpoint; use min_tag_id and max_tag_id instead"
},
"meta":
{
"code": ​200
},
"data": [ ]
}
Why return null array?
And what is max_tag_id, min_tag_id?
You are almost definitely seeing no results because the hashtag you are searching for has not been used in your last 20 posts.
This is a short article explaining how the new Instagram API works.
TL;DR: If your app is in sandbox mode, it can only see see the past 20 posts by you or your Sandbox users.

Outlook Mail REST API: send message with attachment

I'm trying to use next API method: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessages. Sending messages without attachments works just fine, but I can not understand how to send message with attachments.
According to docs, Message structure can contain array of Attachments with items of type https://msdn.microsoft.com/office/office365/APi/complex-types-for-mail-contacts-calendar#RESTAPIResourcesFileAttachment . Problem is in the field ContentBytes -- it is impossible to dump bytes to JSON before sending request to this API method (actually dumping any BLOB to JSON is nonsense).
How should I pass Attachments using REST API at all?
Thanks.
There's an example of passing the attachment on that page: https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#SendMessageOnTheFly
I know I'm 3 years late but, you can look at this example:
https://msdn.microsoft.com/office/office365/APi/mail-rest-operations#create-and-send-messages (if you don't get forwarded to the section "Create and send messages", please scroll manually).
I know it is 365 and not Microsoft Graph but request is absolutely same.
This is basically how JSON representation of the post method looks:
https://outlook.office.com/api/v2.0/me/sendmail
{
"Message":
{
"Subject": "Meet for lunch?",
"Body": {
"ContentType": "Text",
"Content": "The new cafeteria is open."
},
"ToRecipients": [
{
"EmailAddress": {
"Address": "garthf#a830edad9050849NDA1.onmicrosoft.com"
}
}
],
"Attachments": [
{
"#odata.type": "#Microsoft.OutlookServices.FileAttachment",
"Name": "menu.txt",
"ContentBytes": "bWFjIGFuZCBjaGVlc2UgdG9kYXk="
}
]
}
}

Resources