Forums

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

Using forward slash in issue property key

Frederik Vilhelmsen November 23, 2022

When trying to set a new issue property I get 403 permission denied, when the key name has a forward slash in its name. Is it in any way possible to create a key with a forward slash?

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-properties/#api-rest-api-3-issue-issueidorkey-properties-propertykey-put

 

Example:

Works:

/rest/api/3/issue/${issueKey}/properties/this-is-a-property-key
Doesn't work:
/rest/api/3/issue/${issueKey}/properties/this/is/a/property/key
/rest/api/3/issue/${issueKey}/properties/this%2Fis%2Fa%2Fproperty%2Fkey

Error message:

ok: false,
status: 403,
statusText: 'Forbidden'

Another thing is the error message, which is very unclear.

 

2 answers

0 votes
Frederik Vilhelmsen November 23, 2022

I forgot to add that making a request with basic authentication like this, does work.

But what I am trying to do is add a property while requesting as app withing my forge app, like this:
api.asApp().requestJira(route`/rest/api/3/issue/${issueKey}/properties/this/is/a/property/key
Making the request above, does not work.
My manifest permissions:
permissions:
  scopes:
    - write:jira-work
    - read:jira-work
Tom Lister
Community Champion
November 23, 2022

Hi @Frederik Vilhelmsen 

The requests shown are not the same. The Forge version is sending two sets of properties which I would not expect to work. At best it would ignore one of the properties key values. Are you also passing the properties values in the request body?

Frederik Vilhelmsen November 23, 2022
const test2 = async (issueKey) => {
    const response = await api.asApp().requestJira(route`/rest/api/3/issue/${issueKey}/properties/this/is/a/property/key`, {
        method: 'PUT',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json'
        },
        body: `[{"added":"this-is-my-value"}]`
    });
    console.log(response);
};
Hello Tom.
My request looks like this. Can you elaborate on the first part of your answer? I edited the request in my answer, as the original request had typos. Thanks :)
Tom Lister
Community Champion
November 23, 2022

Hi @Frederik Vilhelmsen 

The basic issue here is that using slashes will not be processed as a property key but as a path to be executed on the server.

The values passed are documented as being "Path Parameters" and not name/value parameters. i.e. you are allowed to add issue and property keys into the path.

This will always result in error codes being returned when other paths are detected i.e. unexpected slashes in the call.

The only option is to use expected property key formats such as '-' 

0 votes
Tom Lister
Community Champion
November 23, 2022

Hi @Frederik Vilhelmsen 

The only formatting constraints documented is that property keys should be JSON forgettable.

However any slashes in the the request URL are going to be interpreted as a path so using slashes in proper keys will not work via REST.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events