Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with RESTapi endpoint manipulation  RSS feed

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a dropwizard application to POST/GET query information. I have a `@POST` method that populates an arrayList with my query and its' 11 parameters. For brevity, I cut the example down to only show 3 parameters.

   

I can send a get request through ARC and it will return successful with a json representation of the query.

I run into issues when I try to make a `@GET` request on the specific `queryId` and return a specific parameter of it. As such,

   

On the rest client I make a get request to

I'm expecting that to return the action type of that specific `queryId`, but instead is returning null.
 
Saloon Keeper
Posts: 1930
239
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dj Marlins wrote:


The template in the @Path annotation only specifies only path parameter: queryId.

Did you mean have this?:

 
Dj Marlins
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:

Dj Marlins wrote:


The template in the @Path annotation only specifies only path parameter: queryId.

Did you mean have this?:



Yes I did mean to have that.
 
Dj Marlins
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I make a request like this:


It is returning the string output of just "action", how can I get it to return the action of the query I populated in the arrayList object?
 
Ron McLeod
Saloon Keeper
Posts: 1930
239
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dj Marlins wrote:... It is returning the string output of just "action" ...

What URI are you using to call the web service?

Dj Marlins wrote:... how can I get it to return the action of the query I populated in the arrayList object?

Where is the ArrayList?  I don't see one in the code that you posted.
 
Dj Marlins
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URI I'm using is



I wish to have it return "encrypt".

Currently I have



Which when hitting that endpoint returns
 
Ron McLeod
Saloon Keeper
Posts: 1930
239
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well .. you are making a call which gets handled by this method:
Using this URI:
Which means the path parameters get set as follows:
    queryId = "b622d2c6-03b2-4488-9d5d-46814606e550"
    eventType = "eventType"
    action = "action"

And you are returning a String value of: "Get action parameter: " + action

And the client application is seeing:
Seems correct to me - why would you expect anything different?
 
Ron McLeod
Saloon Keeper
Posts: 1930
239
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dj Marlins wrote:


How are these two handlers related?
 
Dj Marlins
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How are these two handlers related?

The top one is used to generate a query with the desired arguments, and I want to retrieve each argument in the query through individuals @GET requests.
 
Dj Marlins
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:


How are these two handlers related?


The @POST method returns the query. So I have 10 separate @GET requests with corresponding endpoints to return each parameter within the query.
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!