Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to transfer parameters from Gadget to REST method ? Edited

I have a gadget that consumes a REST resource via AJAX call:

args: [
{
key: "version",
ajaxOptions: function ()
{
return {
url: "/rest/daysleftinversionresource/1.0/days-left-in-iteration/getVersion",
data: {
projectId : gadgets.util.unescapeString(this.getPref("projectId")),
}
};
}
}
]

==> from the other side, the REST resource method is as follow

@GET 
	//@AnonymousAllowed
	//@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
	@Path("/getVersion")
	public Response getVersionMethod(@QueryParam("project_id") @DefaultValue("project-10000") String key)
	{
		Long projectId = Long.valueOf(key.substring("project-".length()));

	

The method is always taking the default value and a warning about parameters is being consumed by a servlet is raised and a recommendation to use @FormParam instead of @QueryParam is given.

I am confused and troied so many alternatives but couldnt find a solution how to transfer my param from Gadget to REST Method,.

Do you have any recommendation ?

 

1 answer

1 accepted

0 votes
Answer accepted

I discovered the issue was a type in the project_id QueryParam. It should much the Gadget projectId variable.

Suggest an answer

Log in or Sign up to answer
TAGS

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