how to short url by using google firebase dynamic link if the url contains '#' - firebase

i am using firebase dynamic link to shorten my url but on doing so its gives the response of "warningCode": "UNRECOGNIZED_PARAM" as my url contails '#' sign. and its generates the short url of the data before # and ignores the data after #.
My url is mentioned below:-
"https://example.page.link/?link=https://example.com/#/xyz/pqr/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.aTExSk5la3ZMUVUwTGU2ZTA3OThrdFRkVXE3ZThUZ0lZNzdpckVDcDhSRkIrZHBSUDl0ZFU0SlJOUkYwN0hwYXp2aUF4RlVZZjlTdGYzRnVJWlZpTlRxUDJvWlhyWVhCemJHa1VDc053Sm0vRmlYZlh4bGRb2xjcHM1RmhhdktkY2dRa1RhUlFPQjIya0Z2bWJSeEQ4YVFhY2FtSlJUOGFVMVR5ZUhOZm54Zz09.dhDJWIz9gqmnbhRhkwgZolwNZ8ba4CCjDEYlefkilPc"
i am calling api:-
https://firebasedynamiclinks.googleapis.com/v1/shortLinks?key=my-key

encode the url first before passing it to the api end point

Related

How to include UPI payment URL inside Google QR Code generator URL?

I want to include "upi://pay?pa=8871459686#paytm&pn=Paytm%20Merchant&mc=abc&mode=02&orgid=000000&paytmqr=abcdefg&sign=abc+xyz/pqr/+stu"
this UPI payment link inside Google QR code generator link but when I am adding this link inside the URL ("https://chart.googleapis.com/chart?cht=qr&chs=315x315%26chl=") I am only getting "8871459686#paytm" after scanning QR code.
What I tried :
https://chart.googleapis.com/chart?cht=qr&chs=315x315%26chl=upi://pay?pa=8871459686#paytm&pn=Paytm%20Merchant&mc=abc&mode=02&orgid=000000&paytmqr=abcdefg&sign=abc+xyz/pqr/+stuchoe=UTF-8%26chld=L
Please can anyone tell me what will be the right way to add this "upi://pay?pa=8871459686#paytm&pn=Paytm%20Merchant&mc=abc&mode=02&orgid=000000&paytmqr=abcdefg&sign=abc+xyz/pqr/+stu" inside google QR code generator link.
Since Google api is using "get" method, you should encode your parameter ("upi://pay?pa=8871459686#paytm&pn=Paytm%20Merchant&mc=abc&mode=02&orgid=000000&paytmqr=abcdefg&sign=abc+xyz/pqr/+stu")
In JavaScript & PHP, you can urlencode() function to encode the parameters.
variable = urlencode(text)
Send URL encoded variable value in google API URL.

Linkedin eventSubscription API is giving a 403 error

I am using
PUT https://api.linkedin.com/v2/eventSubscriptions/(developerApplication:urn:li:developerApplication:{developer application ID},user:urn:li:user:{member ID},entity:urn:li:organization:{organization ID},eventType:ORGANIZATION_SOCIAL_ACTION_NOTIFICATIONS)
Linkedin API with all the parameters intact. Each URN is encoded as urn:li:organization:12345 is encoded to urn%3Ali%3Aorganization%3A12345 but still getting a 403 Response.
I think you forget to add this in headers :
X-Restli-Protocol-Version:2.0.0
The application id is actually a numeric field in the url when you visit your application settings, put that value instead of the client id.
So it turns out that there's a lot of missing/incorrect information in the documentation. Since I'm working in go, here's how I finally got the url formatted correctly:
fmt.Sprintf(
"https://api.linkedin.com/v2/eventSubscriptions/(developerApplication:%s,user:%s,entity:%s,eventType:ORGANIZATION_SOCIAL_ACTION_NOTIFICATIONS)",
url.QueryEscape(fmt.Sprintf("urn:li:developerApplication:%s", appId)),
url.QueryEscape(fmt.Sprintf("urn:li:person:%s", userId)),
url.QueryEscape(fmt.Sprintf("urn:li:organization:%s", organizationID)),
)
The breakdown:
The URNs, and only the URNs, need to be urlencoded.
Not the surrounding parentheses
Not the commas
Not the colons preceding the URNs (developerApplication:, user:, and entity:)
Your PUT request needs to include the X-Restli-Protocol-Version header and Authorization header
If, for some reason, you use the /rest/eventSubscriptions/ url instead of /v2/eventSubscriptions/, you also need to include the LinkedIn-Version header
The appId is not your app's client id, but instead the numeric id you see in the app settings url in the linkedin developer portal (i.e. https://www.linkedin.com/developers/apps/<appId>/auth)
The URN structure in the docs is wrong: you need to use urn:li:person:<userId>, not urn:li:user:<userId>

How can I get custom querystring included in returned firebase dynamic shortlink

I'm using the Firebase dynamic link post API to return a shortlink. When I post this:
https://CENSORED.page.link/?link=https://www.CENSORED.co.uk/offers/friends/?utm_source=referafriend&utm_medium=ecrm&utm_campaign=cbk25&utm_term=988776
clicking the returned shortlink redirects to:
https://www.CENSORED.co.uk/offers/friends/?utm_source=referafriend
The post is made from clientside js. Firebase is returning a working shortlink, but with some parameters missing.
Expected url from clicked shortlink:
https://www.CENSORED.co.uk/offers/friends/?utm_source=referafriend&utm_medium=ecrm&utm_campaign=cbk25&utm_term=988776
Looks like its chopping off most of my querystring - how do I get the full query string returned correctly please?
Solved: Escaping the url worked for me:
params lost:
"https://www.test.co.uk/testing/?utm_source=jam&utm_medium=spoon&utm_campaign=jar&utm_term=lid"
params returned correctly:
"https%3A%2F%2Fwww.test.co.uk%2Ftesting%2F%3Futm_source%3Djam%26utm_medium%3Dspoon%26utm_campaign%3Djar%26utm_term%3Dlid"

Having two ? in a URL - Is it valid?

Here is the thing:
Let's say I have a base URL like this:
www.mysite.com?my_first_param=1&my_second_param=2
But now I want to add a new parameter to my URL:
www.mysite.com?my_first_param=1&my_second_param=2&my_redirect_site=www.myothersite.com
Imagine that I am using a service where they add new tracking parameters to my URL. For example:
first_tracking=value1&second_value=value2
Since my BASE url already has a "?" the parameters are added with a "&", so my final URL would look like this:
www.mysite.com?my_first_param=1&my_second_param=2&my_redirect_site=www.myothersite.com&first_tracking=value1&second_value=value2
This is a correct URL with several parameters, but when I do the redirect to www.myothersite.com, since the parameters start with a "&", they get lost. Would it be correct to add the tracking parameters with a starting "?" ? Like this:
www.mysite.com?my_first_param=1&my_second_param=2&my_redirect_site=www.myothersite.com?first_tracking=value1&second_value=value2
If not, what would be a good approach for dealing with this? I believe is responsibility of the redirect to pass through the tracking parameters to the redirect URL.
You should URLencode each param name and value properly, so if the map of params you want is this:
my_first_param => 1
my_second_param => 2
my_redirect_site => www.myothersite.com?first_tracking=value1&second_value=value2
then you should pass this as the query string:
?my_first_param=1&my_second_param=2&my_redirect_site=www.myothersite.com%3Ffirst_tracking%3Dvalue1%26second_value%3Dvalue2
You should be using a library which does this already to build up URIs to handle this encoding for you.
No, you can't have a second question mark in a URL.
Furthermore, if you have ampersands in the redirect URL, they will be seen as separate parameters for the main URL, and not seen as connected to the redirect URL.
If you want to do a redirect like this, you need to URLEncode the whole of the redirected URL. There are standard functions in most web-facing languages to do this.
Encode the parameter, "?" would be replaced by %3F
It depends on the amount of control you have over the service adding the tracking parameters.
Can you change the url after the parameters have been added?
If you can, then you should use a url builder to add the tracking parameters to your redirect url, then url encode that url entriely, tracking parameters included.
If you are not in control and a third party modifies your url, then you will have to do this when you redirect, read the parameters in the url, take your redirect url and the tracking parameters, add the tracking parameters to the redirect url before redirect.

Url rewriting, raw url is omitting special characters

I am creating a site in asp.net with URL rewriting.
My initial url is like
/mypage/languagename/ASP.NET
it is working fine when I am excepting taking the language name with
HttpApplication app = (HttpApplication)sender;
app.Request.RawUrl // this is giving me ASP.NET
but when the initial URL is
/mypage/languagename/C#
I am getting only C from the rawURL instead of C#.
How can I get the same?
Use UrlDecoder becasue # is URL Encoded Character
You need to encode that url because it contains html special character, ie the #
Check this class, System.Web.HttpServerUtility. Use that class UrlEncode method to encode the url before using and it will solve your problem.

Resources