Jump to content

iBridge Jira Integration


Recommended Posts

  • 1 month later...

@Steve G & @Steve Giller
we were able to figure it out, now we want to bring further the integration with Jira, so we would like to test some API calls, the question is, which is the best practice for choosing a right user to create an API key against?
I mean, if i create an API key from my user, whith this key you can potentially do any action in my name (and with all my permission), right?
Also if we want to post update against timeline and requests, the API key should be linked to a licensed service manager user with right access to request type and services, right?

Link to comment
Share on other sites

2 hours ago, Giuseppe Iannacone said:

which is the best practice for choosing a right user to create an API key against?

Think of whatever user would perform the actions manually. Update a request? Needs relevant roles to access the request. Update a service? Needs relevant roles to access the request. Etc. In summary, if the API post updates on request timelines then it needs a key for a user that has the relevant access to requests.

Link to comment
Share on other sites

  • 2 weeks later...

@Giuseppe Iannacone

This error message comes about because when the API is being invoked you are specifying a different service endpoint in the POST URL than you have specified in the XMLMC payload. The following example would throw this exact message, because we are posting to the "automation" service (last part of the URL) but specifying the "session" service in the <methodCall service="session"> attribute

Gerry

POST /<your instance>/xmlmc/automation/
<methodCall service="session" method="userLogon">
	<params>
		<userId>admin</userId>
		<password>cGFzc3dvcmQ=</password>
	</params>
</methodCall>
Link to comment
Share on other sites

Hi @Giuseppe Iannacone,

Are you building and sending API calls from Jira back into Hornbill? If so, which Jira app are you using to implement this?

From your error message, it appears that you're using a JSON payload, which is not officially supported by Hornbill (yet). It works, but the JSON schema description is liable to change - as it did in the most recent release of the Hornbill platform. So I expect you are sending something like the following (from Gerry's XML example above):

{
	"methodCall": {
		"@service": "session",
		"@method": "userLogon",
		"params": {
			"userId": "admin",
			"password": "cGFzc3dvcmQ="
		}
	}
}

 When now you should be sending:

{
	"@service": "session",
	"@method": "getSessionDetails",
	"params": {
		"userId": "admin",
		"password": "cGFzc3dvcmQ="
	}
}

Note the lack of methodCall property in the second snippet.

Cheers,

Steve

  • Like 3
Link to comment
Share on other sites

@Giuseppe Iannacone

As of now, XML is the supported payload format for the API as it stands today.  JSON works (as you know), but its not officially supported because its currently implemented as a transform of XML, and therefore subject to XML Schema validation. The problem is, while JSON is currently accepted as valid input, the order of the properties inside an object presented is important today, this is fine technically, but wrong when you consider JSON being generated from a JavaScript object using something like JSON.stringify() where there is no guarantees of what order the properties inside an object will be serialised. It is for this reason that JSON is not officially supported for API request messages.  For API responses, JSON is fully supported without any issues.  

The problem you encountered above is because we have recently changed the structure of the JSON request message, to bring it in line with the JSON response structure, we made that decision because we assumed than no one was using JSON as we do not document it, or describe its use anywhere, and you will see if you look in the browser network tab and inspect the API calls from our front end, we always sent API requests in XML and get JSON responses. 

Now I have answered your question with a description because I am reluctant to just answer plain "Yes" to your question, and here is why.  You will see in the platform roadmap that we are working on a fairly big change around the API's, the primary objective is to transition our API implementations become JSON-first, that is, we will continue to support XML as we use today, but we will equally support JSON, and we will be transitioning all of our code to use JSON instead of XML over time. This work is in flight and the above change was one of the changes resulting from this work. 

So with the above explanation, the answer I can give you is... XML is the officially supported request payload because its 100% compliant with the XML Schema specification, and is currently our primary supported scheme.  JSON is 100% functional, and you can use it, but, when using JSON, you must be aware that the properties in the request object are required to be presented in a specific order because we effectively validate that input with the XML Schema validator.  Over the coming weeks, we will be transitioning our services over to a new scheme where JSON will be correctly supported with its own validation scheme, and so really in a matter of a small number of months I will be saying "use JSON"...

So my advice would be at this time, if you are using JSON for integration, and its working for you, continue to use JSON, but you will need to change the JSON request message payload to not include the methodCallResult top-level object as described above.  You can take this as an official statement that the JSON request format now is not going to change again, so it will be very safe for you to continue to use JSON without having any future issues, but as of today the documentation does not reflect this.
 
As I write this I realise this is not ideal, we are in flight with a change so we have to default our official position to what we know is not going to change, but in a few weeks time the answer will be very different and I want to make sure you take the best path. 

Hope this makes some sense.

Gerry

 

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...