Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot url Encode pullRequest.title smartvalue

joshua.peeling
Contributor
July 14, 2020

I am trying to set up a Jira automation rule for my project that will get triggered when a pull request is created. As part of the rule, I want to perform an api web request to gitlab using the title of the pull request as a query parameter. 

When I try to do

https://my-gitlab-api-url?search={{pullRequest.title.urlEncode}}

I am getting back a 500 response. I've tried the alternate approach as well by doing 

https://my-gitlab-api-url?search={{#urlEncode}}{{pullRequest.title}}{{/}}

and this does not work either. It doesn't seem that I can get the pullRequest.title smart value to be url encoded. Am I missing something? Thanks.

1 answer

1 accepted

1 vote
Answer accepted
Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 15, 2020

Hello Joshua

Thanks for writing to us. If title is String value, then urlEncode should work on it. 
500 response code does not means that URL was not encoded, seems like some other issue.

I would request you do some research at your end:

  • Try using "Log Action" in rule and Log message "{{pullRequest.title.urlEncode}}" as part of the rule and then check in audit logs what is the result.
  • Then try forming a URL , check if it looks good to you, try hitting it in your browser: https://my-gitlab-api-url?search={result from above step} and see if this is actually giving results you are looking for.

For help in debugging you can refer document: https://support.atlassian.com/jira-software-cloud/docs/debug-a-rule/

If encoding is happening(which I believe is) then probably you are forming wrong query param, might will have to try correct url. 

Hope this helps!

Cheers
Sherry

joshua.peeling
Contributor
July 20, 2020

Thanks! I added a "Log Action" as you suggested in the rule, and was able to figure out the problem. It was a misformatted query param like you mentioned. Once I restructured the URL it worked like a charm. Much appreciated!

Like Sherry Goyal likes this
Sherry Goyal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 21, 2020

@joshua.peeling Good to hear this!

Suggest an answer

Log in or Sign up to answer