Katedral Pillon
Katedral Pillon

Reputation: 14864

Error generating the API metadata for Cloud Endpoints classes in Eclipse

I have two different cloud endpoint methods with two different name signatures

@ApiMethod(name = "getWhiteCats", httpMethod = HttpMethod.POST)
 public CollectionResponse<Cat> getWhiteCats(CatCall request)

And

@ApiMethod(name = "getGrayCats", httpMethod = HttpMethod.POST)
public CollectionResponse<Cat> getGrayCats(CatCall request)

But Eclipse is giving the exception

Description Resource Location Path Type There was a problem generating the API metadata for your Cloud Endpoints classes: com.google.api.server.spi.config.validation.DuplicateRestPathException: Multiple methods with same rest path "POST collectionresponse_cat":"getWhiteCats" and "getGrayCats"

Any thoughts on how I might resolve this issue?

Upvotes: 0

Views: 296

Answers (2)

Nanuck Dogg
Nanuck Dogg

Reputation: 15

You need to specify a path for your methods with path = "yourPathHere". It should look something like this:

@ApiMethod(name = "getWhiteCats", path = "getWhiteCats", httpMethod = HttpMethod.POST)
 public CollectionResponse getWhiteCats(CatCall request)

and

@ApiMethod(name = "getGrayCats", path = "getGrayCats", httpMethod = HttpMethod.POST)
public CollectionResponse getGrayCats(CatCall request)

The path doesn't have to be the name of your @ApiMethod but I highly recommend it.

Upvotes: 0

Manish Patiyal
Manish Patiyal

Reputation: 4477

I solved this issue by passing one more parameter in the @apiMethod annotation for example in your case

@ApiMethod(name = "getWhiteCats", path="Somepath_realted_to_your_service", httpMethod = HttpMethod.POST)

Upvotes: 0

Related Questions