[Development] In Bamboo Plugin, how to consume REST API call for developed plugin
Asked by Muhammad Ramzan_Atlassian Certified Master_:

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\>


Answers:
author: Rafael Pinto Sperafico
body: Hi [@Muhammad Ramzan_Atlassian Certified Master_](/t5/user/viewprofilepage/user-id/1027955) ,

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

comments: author: Muhammad Ramzan_Atlassian Certified Master_
body: 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.*


author: Rafael Pinto Sperafico
body: Hi [@Muhammad Ramzan_Atlassian Certified Master_](/t5/user/viewprofilepage/user-id/1027955) ,

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


author: Muhammad Ramzan_Atlassian Certified Master_
body: 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


Tags: app

bamboo-app

bamboo-development

developer

refapp