Table of Contents

    API

    Mock Server

    Use this URL to access a mockup of the API server. Your traffic will be recorded and compared to the documentation. You'll find your traffic analysis in the inspector or directly here in the documentation, right next to each resource.

dollyaswin.net

This is an example API Documentation. This API is built by Zend Framework 2. Please check source code here https://github.com/dollyaswin/zf2-restful

Book Resources

The following is a section of resources related to the book collection

GET

/zf2/public/api/book

List books collection

Response

200 (OK)
Content-Type: application/json
{"books":[
    {"id":"1","isbn":"1234567891","title":"Book 1","publisher":"O\u0027reilly","page":"456","description":"No description"},
    {"id":"2","isbn":"2345678901234","title":"Book 2","publisher":"Approx","page":"689","description":"Book 2 description"},
    {"id":"3","isbn":"0987654321","title":"Book 3","publisher":"O\u0027reilly","page":"589","description":"Nothing"}
    ],
 "_metadata":{"count":3}
}

GET

/zf2/public/api/book/1

Get book record by pass id. Example id: 1

Response

200 (OK)
Content-Type: application/json
{"book": {"id":"1","isbn":"1234567891","title":"Book 1","publisher":"O\u0027reilly","page":"456","description":"No description"}}

POST

/zf2/public/api/book

Add book record

Response

201 (Created)
Content-Type: application/json
{"book":{"isbn":"1234567891234","title":"Book 4","publisher":"O\u0027reilly","page":"399","description":"Book 4 Description"}}

PUT

/zf2/public/api/book/1

Update book record by pass id in url. Example id: 1

Response

200 (OK)
Content-Type: application/json
{"book":{"isbn":"1234567891","title":"Book 1","publisher":"O\u0027reilly","page":"499","description":"No description"}}

DELETE

/zf2/public/api/book/4

Delete book by id. Example id: 4

Response

200 (OK)
Content-Type: application/json
[]

Country Resources

The following is a section of resources related to the country collection

GET

/zf2/public/api/country

List country collection

Response

200 (OK)
Content-Type: application/json
{"country":[
    {"name":"Afghanistan","currency":"Afghani","currency_code":"AFN"},
    {"name":"\u00c5land Islands","currency":"Euro","currency_code":"EUR"},
    {"name":"Albania","currency":"Lek","currency_code":"ALL"}
    ],
 "_metadata":{"count":3}
}