Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

[Development] In Bamboo Plugin, how to consume REST API call for developed plugin

Edited
Muhammad Ramzan Community Leader Jul 27, 2019

I have developed a bamboo plugin, as per the tutorial i can access the rest url when using 

atlas-run
http://<host>:5990/refapp/rest/myrestresource/1.0/message

But now i have installed the plugin to my bamboo instance, how can i access the rest url of my plugin. i am tyring to access it using url as 

 

http://localhost:8085/bamboo/rest/myrestresource/1.0/message

not its showing me page not found error.

 

/**
* A resource of message.
*/
@Path("/message")
public class MyRestResource {

@GET
@AnonymousAllowed
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getMessage()
{
return Response.ok(new MyRestResourceModel("Hello World")).build();
}
}

 

 

<?xml version="1.0" encoding="UTF-8"?>

<atlassian-plugin key="${atlassian.plugin.key}" name="${project.name}" plugins-version="2">
<plugin-info>
<description>${project.description}</description>
<version>${project.version}</version>
<vendor name="${project.organization.name}" url="${project.organization.url}"/>
<param name="plugin-icon">images/pluginIcon.png</param>
<param name="plugin-logo">images/pluginLogo.png</param>
</plugin-info>
<!-- add our i18n resource -->
<resource type="i18n" name="i18n" location="RestAPI"/>
<!-- add our web resources -->
<web-resource key="RestAPI-resources" name="RestAPI Web Resources">
<dependency>com.atlassian.auiplugin:ajs</dependency>
<resource type="download" name="RestAPI.css" location="/css/RestAPI.css"/>
<resource type="download" name="RestAPI.js" location="/js/RestAPI.js"/>
<resource type="download" name="images/" location="/images"/>
<context>RestAPI</context>
</web-resource>
<rest name="My Rest Resource" i18n-name-key="my-rest-resource.name" key="my-rest-resource" path="/myrestresource" version="1.0">
<description key="my-rest-resource.description">The My Rest Resource Plugin</description>
</rest>
</atlassian-plugin>

1 answer

Hi @Muhammad Ramzan ,

Could you please confirm the plugin you have installed is enabled under Bamboo administration >> Manage Add-ons? If you open Bamboo logs (e.g <bamboo-home>/logs/atlassian-bamboo.log or <bamboo-install>/logs/catalina.out) search for your plugin groupId property described in pom.xml - check if there are any error(s) whilst loading the plugin.

Have you created your plugin using atlas-create-refapp-plugin or atlas-create-bamboo-plugin? Is it possible to mare your source code available on https://bitbucket.org or GitHub for review?

Looking forward to hearing back from you.

Kind regards,

Rafael

Muhammad Ramzan Community Leader Jul 29, 2019

Thanks for your kind reply.

 

Yes , plugin is enabled on Bamboo , i verified and in logs everything is fine. 

 

I crated using " atlas-create-refapp-plugin", its working on JIRA and i can access the rest url in JIRA.

 

But in Bamboo i can't , i tried even using the Rest Browser plugin, but no url found.

Hi @Muhammad Ramzan ,

Thank you for your reply.

At this moment, it is difficult to troubleshoot this issue without looking at the source code, I am afraid. Based on what you have provided you should be able to access the endpoint mentioned, however, the 404 suggests the plugin is not working as expected. 

Please, have a look if all modules for your plugin are enabled - specially the one that relates to your rest api, e.g My Rest Resource. You can review this information from the same place mentioned previously - Bamboo administration >> Manage Add-ons - then search for your plugin and expand it to review its modules.

Kind regards,

Rafael

Muhammad Ramzan Community Leader Jul 29, 2019

I even tried the default settings, once project was created by atlassian command i just installed the plugin with same settings as it is but no success 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bamboo

Bamboo Data Center on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

59 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you