Hello,
I created a web request automation and this works:
https://dev.azure.com/instance/team/_apis/wit/workitems/$Bug?api-version=7.1-preview.3
However, this does not:
https://dev.azure.com/instance/team/_apis/wit/workitems/$Product Backlog Item?api-version=7.1-preview.3
I believe the spaces in "Product Backlog Item" are breaking the call. Is this a bug or feature? In either case is there a workaround?
Thanks
Hi @lcrusan and welcome to the community!
Yes, spaces are an issue with URLs so I would try encoding the spaces with something like this:
https://dev.azure.com/instance/team/_apis/wit/workitems/$Product%20Backlog%20Item?api-version=7.1-preview.3
That did it, thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mark Segall ,
we can do this work around if we have static value. But in my case, I am getting value from smart variable like - {{issue.summary}}. Any idea how we can handle spaces in endpoint URL if spaces come in this variable.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ankit Rastogi - There are two options for this:
{{issue.summary.urlEncode}}
{{issue.summary.replace(" ","%20")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot, @Mark Segall for very quick response.
I forget to mention, some special characters are also coming in variable so second option would not work I think. I tried first option by below way-
use in endpoint - {{issue.summary.value.urlEncode}}
and it converts my URL by space with '+' , ' (' with '%28' and ')' with '%29'
But not sure it is giving 404 - Not found.
Because I used same on postman that also not working because on postman working without encoding - with spaces and special character in endpoint
Do you have any clue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I just tried combining the two options in my test environment and it works:
{{issue.summary.urlEncode.replace("+","%20")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great, thanks a lot, @Mark Segall
Working with - {{issue.summary.value.urlEncode.replace("+","%20")}}
Means just added value in your solution.
Thanks a lot, Sir!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Mark Segall ,
I am facing one more issue, If I am sending a multiline description with POST API payload, my API is breaking. It is working with single line. Do you have any idea in case how we can send {{issue.description}} variable?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would recommend creating a new question for this one. I must admit that API work is not my strongest skill and it would bring more exposure to the community to have this one as a new question. When you go this route, I would also recommend sharing a screenshot of your current payload (obfuscating any sensitive information of course).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, Thanks!
I have already created - Jira Automation - My Post API is breaking with mul... (atlassian.com)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.