What is "amp;" in the oslc get request and why my URI doesn't work if I include that
I wanted to get all the artifacts/requirements related to specific project in DNG through APIs.
I was actually following this YouTube video: https://www.youtube.com/watch?v=YzrVo6YM0iQ
I understood we can find the URI for this when I execute Get project request i.e, "/rm/oslc_rm/{Project_ID}/service.xml", which is tagged as <oslc:queryBase> within the node <oslc:queryCapability>
I found the URI and try to execute the exact URI without making any changes to URI as mentioned in that you tube video and I ended up with this error "Invalid URL submitted"
So after comparing the URI from you tube with my URI. The only difference I see was the word "amp;" which is placed between oslc.query and projectURL.
Here is my URI:
https://{server name}:9443/rm/views?oslc.query=true&projectURL=https%3A%2F%2Fjazz-
{servername}%3A9443%2Frm%2Fprocess%2Fproject-areas%2F_jaAkFpGvPjfdCIpw
So I just removed that word and tried executing the same URI (without "amp;") and it worked.
I am confused, what is "amp;" and why my request failed to executed when its there.
Do anyone have any idea about this?
Accepted answer
& is encoded as & so if you need to send '&' as part of a query string in a url you have to encode it, whereas '&' in the URL identifies a new parameter is following. In the your string that parameter is projectURL. This is a good example why one should not use '&' in the name of Project Areas, Team Areas, Categories, or Folders just to name a few.
Your next question is why was the amp; in the URL found by your earlier request. This happened because the browser encoded the '&' when it displayed it to you. As Ralph said about familiarizing yourself with URL encoding rules, it will help you recognize these things when you see them.
One other answer
Please educate yourself about URL Encoding: https://www.w3schools.com/tags/ref_urlencode.asp