user1050619
user1050619

Reputation: 20896

wsdl for JSON returned REST services

I'm new to REST Web based services and trying to understanding how the contract is created for JSON returned REST services.

From my understanding, any XML based SOAP/REST services will have a WSDL document.

What document is created for JSON based REST Services?

Upvotes: 2

Views: 6166

Answers (4)

Steven de Salas
Steven de Salas

Reputation: 21497

As the others mentioned a web service definition is not necessary for RESTful services, however if you want to create something similar for your API the industry standard is Swagger/OpenAPI, though GraphQL schemas are also becoming a defacto standard too.

There are also a few other options you can also explore (see wikipedia).

Here is a list of the most common options:

Upvotes: 0

lathspell
lathspell

Reputation: 3310

There is WADL (http://en.wikipedia.org/wiki/Web_Application_Description_Language) although it is not so much used as WSDL for SOAP. REST services written in Java EE automatically generate it as .../application.wadl, PHP suppor is pretty poor as far as I know.

Upvotes: 0

salgua
salgua

Reputation: 698

a REST web service doesn't have any auto explanation document like wsdl, you need to know how the webservice works, reading the documentation provided with it. Generally it works with common requests. Assuming that you have a products REST webservice, you could have:

GET /products -> read all products
GET /products/1 -> read the product 1
POST /products -> create a new product
PUT /products/1 -> update product 1
DELETE /products/1 -> delete product 1 

but you have to know which parameters you need to send to any request. I hope I was clear...

Upvotes: 2

Darrel Miller
Darrel Miller

Reputation: 142184

Every HTTP response has metadata in HTTP headers. One of those HTTP headers is ContentType. The content type identifies a media type which is the contract that the response payload must conform to. The specifications for media types can be found here http://www.iana.org/assignments/media-types/media-types.xhtml

One of the major differences between SOAP and HTTP (as an application protocol) is that SOAP defines the contract at design time, whereas with HTTP the contract is specified in the response message so it can change over time. Therefore it is important for the client to read the content type on each response to know how to process the response.

Upvotes: 1

Related Questions