Creating Awesome Web APIs is a Breeze

Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
{
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
http://example.com/events/oscon2014
{
69 64: 6F 73 63 6F 6E 32 30 31 34 0D,
74 79 70 65: 45 76 65 6E 74 0D,
6E 61 6D 65: 4F 53 43 4F 4E 0D,
64 65 73 63 72 69 70 74 69 6F 6E: 4F 27 52 65 69 6C 6C …
73 74 61 72 74 44 61 74 65: 32 30 31 34 2D 30 37 2D 32 …
65 6E 64 44 61 74 65: 32 30 31 34 2D 30 37 2D 32 34 54 …
6C 6F 63 61 74 69 6F 6E: 4F 72 65 67 6F 6E 20 43 6F 6E …
6F 72 67 61 6E 69 7A 65 72: 4F 27 52 65 69 6C 6C 79 0D
}
http://example.com/events/oscon2014
{
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
http://example.com/events/oscon2014
{
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
http://example.com/events/oscon2014
{
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
{
"@context": {
"name": "http://schema.org/name",
"description": "http://schema.org/description",
"startDate": "http://schema.org/startDate",
...
},
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
"@context": {
"@vocab": "http://schema.org/"
},
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
"@context": {
"@vocab": "http://schema.org/"
},
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
"@context": {
"@vocab": "http://schema.org/"
},
"@id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
"@context": {
"@vocab": "http://schema.org/"
},
"@id": "oscon2014",
"@type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
{
"@context": {
"@vocab": "http://schema.org/",
"startDate": { "@type": "DateTime" }
},
"@id": "oscon2014",
"@type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
{
"@context": {
...
"startDate": { "@type": "DateTime" }
"id": "@id",
"type": "@type"
},
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
{
"@context": "/contexts/event.jsonld",
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
{
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
http://example.com/events/oscon2014
HTTP/1.1 200 OK
Content-Type: application/json
Link: </contexts/event.jsonld>;
rel="http://www.w3.org/ns/json-ld#context";
type="application/ld+json"
{
"id": "oscon2014",
"type": "Event",
"name": "OSCON",
"description": "O'Reilly Open Source Convention 2014",
"startDate": "2014-07-20T16:00:00Z",
"endDate": "2014-07-24T21:00:00Z",
"location": "Oregon Convention Center",
"organizer": "O'Reilly"
}
Creating Awesome Web APIs is a Breeze
<script type="application/ld+json">
...
</script>
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
http://example.com/events/
{
"@id": "/events/",
"@type": "Collection",
"member": [ ... ],
...
"operation": {
"@type": "http://schema.org/AddAction",
}
}
{
"@id": "Event",
"@type": "Class",
"supportedProperty": {
"property": "name",
"required": true
}
}
http://example.com/events/
{
"@id": "/events/",
"@type": "Collection",
"member": [ ... ],
...
"operation": {
"@type": "AddAction",
"method": "POST",
"expects": "Event"
}
}
Creating Awesome Web APIs is a Breeze
{
"@id": "Event",
"@type": "Class",
"supportedProperty": {
"property": "name",
"required": true
}
}
http://example.com/events/
{
"@id": "/events/",
"@type": "Collection",
"member": [ ... ],
...
"operation": {
"@type": "AddAction",
"method": "POST",
"expects": "Event"
}
}
{
"@id": "Event",
"@type": "Class",
"supportedProperty": {
"property": "name",
"required": true
}
}
http://example.com/events/oregon/
{
"@id": "/events/oregon/",
"@type": "Collection",
"member": [ ... ],
...
"operation": {
"@type": "AddAction",
"method": "POST",
"expects": "Event"
}
}
http://example.com/events/oregon/
{
"@id": "/events/oregon/",
"@type": "Collection",
"member": [ ... ],
...
}
{
"@type": "AddAction",
"method": "POST",
"expects": "Event"
}
{
"@id": "EventCollection",
"@type": "Class",
"subClassOf": "Collection",
"supportedOperation": {
"@type": "AddAction",
"method": "POST",
"expects": "Event"
}
}
http://example.com/events/oregon/
{
"@id": "/events/oregon/",
"@type": "EventCollection",
"member": [ ... ],
...
}
{
"@type": "AddAction",
"method": "POST",
"expects": "Event"
}
Creating Awesome Web APIs is a Breeze
/**
* Event
*
* @HydraExpose(iri="http://schema.org/Event")
* @HydraId("event_retrieve")
* @HydraOperations( {
* "event_replace",
* "event_delete"
* } )
*/
class Event
{
/**
* The event's name
*
* @HydraExpose(iri="http://schema.org/name", required=true)
*/
private $name;
// ... other members and methods ...
}
$ php app/console hydra:generate:crud 
--entity=MLEventApiBundle:Event 
--route-prefix=/events/ 
--with-write 
--no-interaction
CRUD generation
Generating the CRUD code: OK
You can now start using the generated code!
/**
* Event controller
*
* @Route("/events")
*/
class EventController extends HydraController
{
/**
* Creates a new Event entity
*
* @Route("/", name="event_create")
* @Method("POST")
*
* @HydraOperation(
* type = "http://schema.org/AddAction",
* expect = "MLEventApiBundleEntityEvent"
* })
*
* @return MLEventApiBundleEntityEvent
*/
public function collectionPostAction(Request $request)
{
...
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
Creating Awesome Web APIs is a Breeze
1 of 58

More Related Content

What's hot(20)

Data Modeling with NGSI, NGSI-LDData Modeling with NGSI, NGSI-LD
Data Modeling with NGSI, NGSI-LD
Fernando Lopez Aguilar1.1K views
RDF, linked data and semantic webRDF, linked data and semantic web
RDF, linked data and semantic web
Jose Emilio Labra Gayo1.5K views
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
Olaf Hartig15K views
Introduction to RDF & SPARQLIntroduction to RDF & SPARQL
Introduction to RDF & SPARQL
Open Data Support12.2K views
HBase RITsHBase RITs
HBase RITs
wchevreuil150 views
JSON-LD for RESTful servicesJSON-LD for RESTful services
JSON-LD for RESTful services
Markus Lanthaler20.8K views
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
Brian Ritchie4.7K views
Apache Atlas: Tracking dataset lineage across Hadoop componentsApache Atlas: Tracking dataset lineage across Hadoop components
Apache Atlas: Tracking dataset lineage across Hadoop components
DataWorks Summit/Hadoop Summit6.7K views
SPARQL 사용법SPARQL 사용법
SPARQL 사용법
홍수 허893 views
Hadoop Security ArchitectureHadoop Security Architecture
Hadoop Security Architecture
Owen O'Malley30.2K views
MongoDB et Elasticsearch, meilleurs ennemis ?MongoDB et Elasticsearch, meilleurs ennemis ?
MongoDB et Elasticsearch, meilleurs ennemis ?
Sébastien Prunier7.3K views
RDF 개념 및 구문 소개RDF 개념 및 구문 소개
RDF 개념 및 구문 소개
Dongbum Kim21.2K views
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
Gregg Kellogg73.4K views
PostgreSQL query planner's internalsPostgreSQL query planner's internals
PostgreSQL query planner's internals
Alexey Ermakov469 views
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
Jose Emilio Labra Gayo3.9K views

Recently uploaded(20)

Creating Awesome Web APIs is a Breeze