Google Shortening API returns null if URL to be shortened is long i.e more than 2000-3000 characters - google-api-client

Recently I have an issue in my project that I need to shorten a URL . I am using Google shortener API .(https://goo.gl)
For small strings, it is working fine and returning correct short URL .
But for Strings having large characters shortened URL is returning null .
So I have 2 questions :
1.) Is any character limit up to which google shortener API is able to convert long urls into short urls .
2.) If 1.) is the case please let me know suggestion so I am able to get short URL from long string also as it is critical for my project .
Suggestions and Help will be very grateful .
Regards,
Deepak

Related

How to use the keyword "location" in the URL parameter in AWS Amplify

I am currently working on a 1 page HTML app that uses URL parameters to do an API call. the URL parameters are set and used in QR codes so its necessary that they are able to change dynamically. A example URL would be something like app.com/index.html/?environment=demo&location=Kiosk
I currently have this app deployed in AWS Amplify, but I cant get other keywords to chain together. I have the following redirects in place:
These redirects make sure that every URL parameter I pass in the link works EXCEPT some keywords like the "location" keyword, next to some others. Using this keyword as a URL param gives a 502 server error, or if the redirects are not used an access denied error.
does anyone know how to get the location keyword to work? Thanks in advance!
You should be able to use a single rule that will forward everything to index.html EXCEPT urls with a "file extension" from the list below. That lets all your links work, but assets like images, fonts, code will pass through.
Doc for: Using Redirects - Single Page Apps
</^[^.]+$|\.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|woff2|ttf|map|json)$)([^.]+$)/>

Using Google Places Web API to search for business and using results to make a phone call

I'm working on a project, and I'm completely stuck.
I get the user's location using CLLocation and am able to get the place name using CLGeocoder, and using this I've constructed a URL to search the Google Places Web API.
My question is, how can I actually complete the search and return the top place result's phone number? Any help would be much appreciated!
let url: URL = URL(fileURLWithPath: "https://maps.googleapis.com/maps/api/place/textsearch/json?query=taxi+" + placeMark.locality!+"&key=" + self.GAPIKEY)
This is the URL I've come up in case that helps
The first thing you need to do is an HTTP GET on the URL to get the API results. Consult the following SO question for various ways to do that:
How to make an HTTP request in Swift?
The data returned will be a JSON document in the format described in the Google Places API Docs. Look for the formatted_phone_number and/or international_phone_number fields. See Working with JSON in Swift for how to parse the JSON string.

Facebook Messenger API:how to break line in a message

In Facebook Messenger chat,we can break a line by press "SHIFT+ENTER".
So how to break line by Facebook Graph API(Messenger API).
I've seen in a few answers that the Graph API accepts <center></center> instead of <br> and some other parts of their API seem to accept \r\n.
Is there currently any way of sending a line break and if there is where it it documented?
Turns out Line break in Facebook status update via Graph API might give you what you are looking for:
Use \u000A
For me it solved my similar issue I had with Facebook SendApi for a Facebook Messenger Bot.
If you are using php, You should be use chr(10) . Its working as like '\n' or '<br>'. Also you can use <center></center> . Its working for me.
I had to use \n\n for the line break to work.
e.g.
"Sorry, We don't have any information ragarding this.\n\nSay 'Hi' to startover"
shows following in facebook messenger
Sorry, We don't have any information ragarding this.
Say 'Hi' to startover
I was trying to get a line break in the welcome text that shows up before users touch Get Started in my Messenger bot. I found that "\n" worked but ONLY in the mobile version of Messenger. It doesn't work on the web at the moment. Assuming that will get fixed at some point because Facebook shows line breaks in their blog post this week (9/12/2016) https://messengerblog.com/bots/messenger-platform-1-2-link-ads-to-messenger-enhanced-mobile-websites-payments-and-more
Though it is not documented, but I suppose "\r\n" would work.
Graph api returns the json response as "\r\n" for messages or posts having a line break.
I'm not 100% sure what language you're using to build your bot, but if you're using PHP then \n needs to be wrapped in double quote strings e.g
$message = "Message \n with a line break";
using single quotes (') won't work.
Though a better solution if using PHP would be to use the PHP_EOL constant
Whatever language you're using to build your bot may have similar quirks
Use language specific line separators.
Java System.lineseprator
php PHP_EOL
Python os.linesep
Nodejs os.EOL
When we use special character in string then JSON conversion understand it as part of string.
In Python \\n breaks the line as expected.
Convert "\n" in your text to "\n" => it working...
With Php this is my code: (tested)
$_text = str_replace(array("\r\n", "\r", "\n"), "\\n", $_text);

adding url with parameters to tweetinvi

I am trying to publish a tweet that includes a url that ends like
?r=twitter&lkey=oxvN3E8o3 and it does not work. Tweeter returns {"errors":[{"code":32,"message":"Could not authenticate you."}]}. but if I remove parameters it works. BTW length is not a problem.
Thanks
I have been check out to your link that is work correctly . Again you try it but you do not enter hello befor link . Only you enter link in publish function.

Facebook Download photo and ServerXMLHTTP

Hello and thanks in advance. Before to post here i search a lot in the net and here as well.
I have a site that let the user join with their facebook profile so with their permission (FB application) the web will download their main photo.
I used this script server side with classic ASP (and i must use ASP) to download the main photo and in random cases it through an error: msxml3.dll The parameter is incorrect.
''DownloadURL is the url pf the photo
''example "http://profile.ak.fbcdn.net/xxxxxxxxxxxxxx.....xxxxxx.jpg"
Dim objXML
Set objXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXML.Open "GET", DownloadURL , true ' <-- this line get the error sometimes
objXML.Send
'.... code to handle the request
' and save photo using ADODB.Stream
But if i try on my workstation the same photo url to reproduce the error, damn this work fine so i cant check what is the problem.
I use Windows 2008 server SE SP2 and IIS7
my questions are:
Is MSXML2.ServerXMLHTTP obsolete ?
what more do i need to know ?
is this related to the client browser (example IE) ?
Any suggestions or tips that i can receive from the gurus here ?
Thanks in advance for this help
The first thing I would suggest that is likely causing a lot of your problems is to not use the profile.ak.fbcdn.net url. That url is not necessarily constant. I would suggest using the supported url of http://graph.facebook.com/facebookid/photo where facebookid is the id of the user who's photo you are downloading.
Regarding the use of MSXML2.ServerXMLHTTP I haven't used that stuff in ages, but it seems like that object probably isn't the best for downloading an image file. Check out this discussion that may be relevant: http://www.daniweb.com/forums/thread153966.html