It's all about the answers!

Ask a question

What is "amp;" in the oslc get request and why my URI doesn't work if I include that

Dharani Muli (154) | asked Mar 14 '21, 2:47 p.m.
edited Mar 14 '21, 2:54 p.m.

I wanted to get all the artifacts/requirements related to specific project in DNG through APIs. 

I was actually following this YouTube video:

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&amp;projectURL=https%3A%2F%2Fjazz-

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

permanent link
Kirk Woods (9158) | answered Mar 15 '21, 9:10 a.m.
edited Mar 15 '21, 9:14 a.m.
& is encoded as &amp; 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.
Dharani Muli selected this answer as the correct answer

Dharani Muli commented Mar 15 '21, 5:34 p.m.

 Thank you Kirk Woods. For the detailed information. 

One other answer

permanent link
Ralph Schoon (61.8k33643) | answered Mar 15 '21, 3:21 a.m.

 Please educate yourself about URL Encoding:

Ralph Schoon commented Mar 15 '21, 3:22 a.m.

The amp likely stands for &. 

Dharani Muli commented Mar 15 '21, 5:33 p.m. | edited Mar 15 '21, 5:33 p.m.

 thank you Ralph Schoon for your suggestion. 

Your answer

Register or to post your answer.