I was looking at the example https://developer.atlassian.com/server/framework/atlassian-sdk/developing-a-rest-service-plugin/ to create a Rest plugin for JIRA. To access the resource I have to give path like this
http://<host>:5990/refapp/rest/myrestresource/1.0/message
This seems to be too big path for me. We have to give the version number, which I do not want. I want something simple like this
http://<host>:5990/refapp/rest/myrestresource/message
How to do that with this example?
Simple answer: You cannot.
Longer answer is that the URL split into few parts, that are handled by different Atlassian product components:
Here's how the parts of the URL are composed and used:
http://host.com:port - The operating system directs the request to the application server (e.g. Tomcat) that handles the specified port.
/refapp - Tomcat directs the request to the application refapp.
/rest - The application's deployment descriptor file (web.xml) maps the URLs to the relevant servlets.
/api-name/api-version - The REST plugin module takes over. The relevant part of the URL (api-name and api-version) are defined as the path and version in the atlassian-plugin.xml file. For example:
<rest key="helloWorldRest" path="/myrestresource" version="1.0">
<description>Provides hello world services.</description>
</rest>
/resource-name - The final part of the URL mapping (resource-name and sub-elements) is done via annotations on the class, used to declare the URI path, the HTTP method and the media type.
If you'd like to have shorter URL, use single number version (ex. 1), and shorter path in your atlassian-plugin.xml file.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.