Community moderators have prevented the ability to post new answers.
You should NOT add any basic auth headers for you add-on requests. This is against the policy for Marketplace add-ons and it is simply not needed.
You are most likely running into this issue, which was recently fixed https://ecosystem.atlassian.net/browse/ACEJS-21. The fix is in a new beta release of ACE, version 1.1.0-beta.3
.
You can work around this problem by changing your code to not reference the absolute URL for the JIRA instance (which is a bad practice anyway, since your add-on can be installed into multiple JIRA instances):
request({ // url: 'http://mirketa:2990/jira/rest/api/2/issue/VTP-3' <-- this is wrong url: '/rest/api/2/issue/VTP-3', method: 'PUT' })
Furthermore, running a JIRA instance locally is no longer supported and you will probably run into problems. Please see our announcement for details on how to migrate: https://developer.atlassian.com/blog/2016/04/cloud-ecosystem-dev-env/
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Seb Ruiz: I did all the set up now - registered for new cloud instance - installed my plugin there. I am still not able to update the issue.
It says : [Error: Invalid URI "/rest/api/2/issue/VTP-3"] - this is when I am using request module.
Code is same:
request({ // To Do url: '/rest/api/2/issue/VTP-3', //URL to hit method: 'PUT', //Lets post the following key/values as form json: { "fields": { "summary":"test 3091" } } }, function(error, response, body) { if (error) { console.log(error); } else { console.log(response.statusCode, body); } });
I have also tried to do it in another way using httpClient. I have successfully got a response on "GET" request but "PUT" request gives a 403 status. I am unable to understand why happened so? It is actually strange to me, why Jira gave a 403 status on PUT & not on GET request?
var httpClient = addon.httpClient(req); httpClient.put({ url: '/rest/api/2/issue/VTP-3', json: { "fields": { "summary":"test 309" } } }, function(err, httpResponse, body){ console.log('body.length=',body.length); console.log('httpResponse.body ==== ',httpResponse.body); console.log("I did it"); });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In your first example, you are using the generic request
module. You are correct to use addon.httpClient(req)
to instantiate the request module that ACE extends. You can read more about this in the README.
The new 403 error you are getting is because your add-on has only requested the READ
scope, which means it is not permitted to create or update issues. In our documentation you can read more about scopes.
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.
@Seb Ruiz: I was able to do it. Thanks. I don't know why I wasn't able to find this documentation which you people have already put on the web. Thanks again !!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Seb Ruiz, If you can provide the documentation of the custom module that extends ACE. Not the README link, but apart from this. For example, I want to find out what all properties are available to "addon" variable & like this to "req" & "res" variables? Do you guys provide any documentation to this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We do not provide this level of detail - but you are welcome to look at the source code.
https://bitbucket.org/atlassian/atlassian-connect-express/src
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You have to add a header to your POST/PUT request.
The header looks like:
Authorization: Basic <base64-encoded user pwd>
Greetings
Sigi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can you show me how to add it?
request({ // To Do url: 'http://mirketa:2990/jira/rest/api/2/issue/VTP-3', //URL to hit method: 'PUT', authorization: "Basic YWRtaW46YWRtaW4=", //Lets post the following key/values as form json: { "fields": { "customfield_10303":"2016-08-03T17:28:00.639+0530" } } }, function(error, response, body) { if (error) { console.log(error); } else { console.log(response.statusCode, body); } });
Is this the right way that I have added? I tried this but it is not working .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I just checked my code: the header for Username test and Pwd test123 is
Authorization: Basic base64(Username + ":" + Pwd), which is
Authorization: Basic dGVzdDp0ZXN0MTIz
I hope this will help.
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.