Aliens
Aliens

Reputation: 1004

RESTful Web Services from Entity Classes

I want to implement restful web-services to query my database.

In Netbeans I did this: - I created entity classes from my db - I generated web-services from these entity classes

GET methods work fine when testing but I have some additional requirements. I dont want to query only by tables' id-s. Data needs to be retrieved also when some other parametres are entered.

For example I have a table: Customer: id, name, address, country

Now I want to display all customers from a specific country.

Where in code can I achieve that?

Upvotes: 2

Views: 2071

Answers (1)

Taryn East
Taryn East

Reputation: 27747

You can do this with slightly different urls.

So for a single customer you'd present a URL such as:

GET /customer/123.html

But for multiple customers, you'd figure out a way to specify groups. If you wanted all customers, you'd go for:

GET /customers.html

But say you grouped by country, you could try:

GET /customers/Australia.html

Using the singular or plural form would separate the two types of get-requests.

Upvotes: 1

Related Questions