Problems with sharing via LinkedIn a link with equal sign - ios

I've encountered an issue with LinkedIn share API.
I am working on a iPhone project, testing my application on iOS 4.0, 5.0.
I used this project as an example:
[https://github.com/synedra/LinkedIn-OAuth-Sample-Client][1]
I thought I am a genius after successfully implementing this API not only for sharing an update, but also with following format(like shown in [https://developer.linkedin.com/documents/share-api][1]):
<?xml version="1.0" encoding="UTF-8"?>
<share>
<comment>83% of employers will use social media to hire: 78% LinkedIn, 55% Facebook, 45% Twitter [SF Biz Times] http://bit.ly/cCpeOD</comment>
<content>
<title>Survey: Social networks top hiring tool - San Francisco Business Times</title>
<submitted-url>http://sanfrancisco.bizjournals.com/sanfrancisco/stories/2010/06/28/daily34.html</submitted-url>
<submitted-image-url>http://images.bizjournals.com/travel/cityscapes/thumbs/sm_sanfrancisco.jpg</submitted-image-url>
</content>
<visibility>
<code>anyone</code>
</visibility>
</share>
Following advices and examples, I was preparing a JSON string that i was using.
So, i got this:
{
"visibility":
{
"code":"anyone"
},
"comment":"Asd",
"content":
{
"submitted-url":"http://google.com",
"title":"googloo",
"submitted-image-url":"http://pikci.ru/images/img_srchttpwwwcomputerrivercomimagessamsung-chat-335-qwer.jpg"
}
}
Well, with this data inside, it works like a charm. the update is with image, clickable title and stuff. Perfect.
Then, i tried to put a link(because i really needed in purpose of my project) with a Equal sign in it: "=", like for example we have
http://www.google.md/#q=Nicolas+Steno&ct=steno12-hp&oi=ddle&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=8c5a975d815425a&biw=1920&bih=881
Well, if we use this link in submitted-url, and send it, the LinkedIn will receive it, and even will give us a response. But it WONT update to the new status! It's a huge bug for my application, because the share won't work, but more than a half of the shared links will have equal sign in it. It is the third day when i'm fighting with it. I was trying different coding functions, different "smarty-pants" moves, but failed.
If anyone has a clue about what is going on here, I will hugely appreciate it...

When I post this body to LinkedIn I get my status updated:
{
"comment": "Posting from the API using JSON",
"content": {
"submitted-url":
"http://www.google.md/#q=Nicolas+Steno&ct=steno12-hp&oi=ddle&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=8c5a975d815425a&biw=1920&bih=881"
}, "visibility": {
"code": "anyone"
}
}
However, the link itself doesn't resolve correctly. It's likely that something about that URL is tripping up our link shortener - we're working on fixing these issues but in the meantime you could use something like the Google URL shortener URL:
body = {"longUrl": article['articleContent']['resolvedUrl']}
resp,content = http.request("https://www.googleapis.com/urlshortener/v1/url?key=xxx","POST",body=simplejson.dumps(body),headers={"Content-Type":"application/json"})
googleresponse = simplejson.loads(content)
... and then share that to LinkedIn. I realize it's a suboptimal solution, but until the share function gets fixed to handle these URLs it should get you going.

Related

Twilio autopilot handoff action is not working with Twiml Bin

I have a Twilio autopilot task from an incoming call, which performs a greeting then asks a question before redirecting to a new task called 'callnumber'. This all works fine.
The 'callnumber' task looks like this
{
"actions": [
{
"handoff": {
"channel": "voice",
"uri": "https://handler.twilio.com/twiml/TWIMLBINID"
}
}
]
}
TWIMLBINID actually has the correct ID from the Twiml Bin.
This is the Twiml content in the bin:
<Response>
<Say>I will put you in contact with our customer care specialist.</Say>
</Response>
Unfortunately I'm not hearing this Response spoken out and instead just get the standard 'an error has occurred' voice message.
I've tried a few different versions of this, even calling an xml file hosted on my own public web server and seeing the same problem. Also tried the dial verb and still seeing this issue.
I feel like I may have missed some configuration, after seeing similar posts like: Twilio autopilot doesnt say what it is supposed to say
Any help is much appreciated!
I was able to get the TwiML Bin working with similar JSON, when I have it associated with a Task that has samples.
So, for example, a call comes in to your Autopilot assistant and initially triggers the Assistant Initiation Task of hello_world where you modified the predefined JSON with a listen action.
{
"actions": [
{
"say": "How can I help you today?"
},
{
"listen": true
}
]
}
You then respond so the task associated with your handoff JSON/TwiML Bin is executed (based on the samples you provided). If you try to call the handoff task directly, it fails.
I have the same JSON for "actions" of the task-seems perfect.
But 2 Small differences for the TwiMLbin :
1)don't forget to put the xml tag in the TwiLbin :
It should be :
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>For this question, I will put you in contact ...</Say>
</Response>
2)I don't understand how your twiMLbin has such an hyperlink. Normally the syntax is
https://handler.twilio.com/twiml/******SID******
and the SID can not be chosen and mine has 34 characters. (do not use the "friendly name" of the twiMLbin). You have a button in the twiMLbin to copy-paste it directly.
for me it works. Otherwise please provide some more elements
-do you have queries associated to the autopilot task ? if you have task(s) that do not have any queries, the model will refuse to build (you can check this in the screen "natural language router" / tab "build models").
-are you sure you don't have conflicting query that triggers another task than the one you think (typically with short queries, they "vampirize" other intents). For that please provide the logs of the queries (query Vs Task) of your autopilot assistant.
nb : I confirm what philnash said : you should really try with a phone call. I experienced also some "glitches" with the Twilio simulator.

Can't get views by insightTrafficSourceType — YouTube Analytics API

So I'm using the 'google-api-client' gem with Rails, and I'm attempting to call the URL below in order to get video views by day and insightTrafficSourceType. This is a call that appears to be allowable from the Available Reports documentation page.
Additionally, I found that I was able to make this call by using the API Explorer tool provided by Google.
URL:
https://www.googleapis.com/youtube/analytics/v1beta1/reports?metrics=views&ids=channel==CHANNEL_ID&dimensions=day,insightTrafficSourceType&filter=video==VIDEO_ID&start-date=2013-01-15&end-date=2013-01-16&start-time=1970-01-01
Result:
{
:error=>
{
"errors"=>[
{
"domain"=>"global",
"reason"=>"invalid",
"message"=>"Unknown identifier (insightTrafficSourceType) given in field parameters.dimensions."
}
],
"code"=>400,
"message"=>"Unknown identifier (insightTrafficSourceType) given in field parameters.dimensions."
}
}
I'm not sure what extra data I can provide in the initial description of this bug, but as stated before I am making the call to the API with the Google::APIClient Ruby library. The actual code itself looks like this:
client.execute(
:api_method => api.reports.query,
:parameters => options
)
You are still referencing the old beta API, i.e., in your URL, you have 'v1beta' and you should have 'v1' there. Try replacing that and running it again. Also, you can look at the api explorer to see the exact URL that should be generated in live examples with your acct (once you enable OAuth) here:
https://developers.google.com/youtube/analytics/v1/
(Look at the bottom of the page.)
Finally, start-time isn't a parameter listed on the production version of the API, so you will want to remove that as well.

Facebook UI call in ASP.NET MVC does not return the picture it should

Does anyone know why the picture attribute is not working in following Facebook UI call?
function postToWallUsingFBUi()
{
var data=
{
method: 'stream.publish',
message: "Posted using FB.ui and picture.",
display: 'iframe',
caption: "Caption",
name: "Name",
//ver 1 picture: 'http://www.somedomain.com/albums/s339/rockaja/fb-520.png',
//ver 2 picture: '#Url.Action("Action", "Controller", new { PageId = Model.PageTabId }, Request.Url.Scheme)',
picture: 'https://localhost/MyVirtualDirectory/Controller/Action/283659015078395',
link: "http://www.mydomain.com/", // Go here if user click the picture
description: "Description field",
actions: [{ name: 'action_links text!', link: 'http://www.mydomain.com' }]
}
FB.ui(data, onPostToWallCompleted);
}
As you can see the picture attribute uses a picture from localhost. If i paste this URL into the browsers's Address field, i get the picture as expected.
I also commented out other two versions:
version 1 is working properly as expected, but
version 2 is not working (this is an ASP.NET MVC call, but that fact does not affect the result).
May be it is due to the fact that i request a localhost-ed picture?!
I have never worked on FB API so take my suggestion with a pinch of salt.
Based on my understanding of how Facebook works, whatever pictures you share on user's wall go into FB's data store first and are always pulled from that store.
Here, The Facebook API may be downloading the picture from the URL you have provided and push it into it's own store before publishing it on user's walls. When you use a localhost url, then the call to download the picture would obviously fail.
There must be another version of the API where you should be able to send the picture content as byte array. If there is, then you can load the picture from disk yourself and send the byte array in the API

Finding Facebook ID from URL

In Facebook's documentation it says you can find the ID from a URL, and that used to be the case. It doesn't appear to be true anymore.
This example is straight from Facebook's API Documentation:
--------------FACEBOOK DOCS---------------------
The "ids" query parameter also accepts URLs. This is useful for finding IDs of URLs in the Open Graph. For example: https://graph.facebook.com/?ids=http://www.imdb.com/title/tt0117500/
But when you click on that link it gives you:
{
"http://www.imdb.com/title/tt0117500/": {
"id": "http://www.imdb.com/title/tt0117500/",
"shares": 18226,
"comments": 7
}
}
Which does NOT include the real Facebook ID for this example URL. If I go to the debugger and enter this URL I can find the ID, which is: 380728101301
So how can I find the ID without using the Open Graph Debugger? I need to be able to get IDs through the code on my site, and can't manually visit the debugger every time.. anyone know how to do this now?
Thanks very much!
There is one possibility with FQL:
SELECT url,site,id FROM object_url WHERE url = 'http://www.imdb.com/title/tt0117500';
https://developers.facebook.com/docs/reference/fql/

$.getJSON with Twitter rate_limit_api

I'm having trouble getting Twitter's rate_limit_status https://dev.twitter.com/docs/api/1/get/account/rate_limit_status to work correctly. I've used to curl and a web browser https://api.twitter.com/1/account/rate_limit_status.json to test it and it does returns a JSON object, but when I run the code below all I get is a 200 so I know I got the response successfully. It's not rated limited so even if I was over my limit it would still work. I've googled it and searched this forum but I can't seem to find why my specific code isn't working. As you can see I've put an alerts in the .getJSON function but neither goes off. I'm using the other Twitter APIs get Friends, get Followers successfully using basically the same code as below. I'm new to JQuery so I'm wondering if I'm missing something. Thanks in advance for any help!
function getRateLimit (){
var uri = "https://api.twitter.com/1/account/rate_limit_status.json";
$.getJSON(uri, function(data) {
alert("Alert before.");
console.log(data["reset_time"]);
console.log(data["remaining_hits"]);
alert("For testing purposes.");
});
}
The Same origin policy prevents that from working. Even if it would work, it would show the rate limit for each user and not for your application. (the rate limit status for the requester's IP address is returned)
You have to to get this data on server-side, everything else makes no sense.

Resources