Document example for spec 0.3

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-08-06 11:22:27 -03:00
parent a9dc14f617
commit 6f2cbd61e4
1 changed files with 79 additions and 5 deletions

View File

@ -6,7 +6,81 @@
npm start
```
## How To Post an Event
## Spec v0.3
__A Structured One__
> Payload [example](../payload/v03/structured-event-0.json)
```bash
curl -X POST \
-d'@../payload/v03/structured-event-0.json' \
-H'Content-Type:application/cloudevents+json' \
http://localhost:3000/v03
```
__A Structured One with Extension__
> Payload [example](../payload/v03/structured-event-1.json)
```bash
curl -X POST \
-d'@../payload/v03/structured-event-1.json' \
-H'Content-Type:application/cloudevents+json' \
http://localhost:3000/v03
```
__A Binary One__
```bash
curl -X POST \
-d'@../payload/data-0.json' \
-H'Content-Type:application/json' \
-H'ce-specversion:0.3' \
-H'ce-type:com.github.pull.create' \
-H'ce-source:https://github.com/cloudevents/spec/pull/123' \
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
-H'ce-time:2019-06-21T17:31:00Z' \
http://localhost:3000/v03
```
__A Binary One with Extension__
```bash
curl -X POST \
-d'@../payload/data-0.json' \
-H'Content-Type:application/json' \
-H'ce-specversion:0.3' \
-H'ce-type:com.github.pull.create' \
-H'ce-source:https://github.com/cloudevents/spec/pull/123' \
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
-H'ce-time:2019-06-21T17:31:00Z' \
-H'ce-my-extension:extension value' \
http://localhost:3000/v03
```
__A Binary One with Base 64 Encoding__
```bash
curl -X POST \
-d'@../payload/data-1.txt' \
-H'Content-Type:application/json' \
-H'ce-specversion:0.3' \
-H'ce-type:com.github.pull.create' \
-H'ce-source:https://github.com/cloudevents/spec/pull/123' \
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
-H'ce-time:2019-06-21T17:31:00Z' \
-H'ce-datacontentencoding:base64' \
http://localhost:3000/v03
```
__A Batch One__
TODO
## Spec v0.2
### How To Post an Event
__A Structured One__
@ -16,7 +90,7 @@ __A Structured One__
curl -X POST \
-d'@../payload/v02/structured-event-0.json' \
-H'Content-Type:application/cloudevents+json' \
http://localhost:3000/
http://localhost:3000/v02
```
__A Structured One with Extension__
@ -27,7 +101,7 @@ __A Structured One with Extension__
curl -X POST \
-d'@../payload/v02/structured-event-1.json' \
-H'Content-Type:application/cloudevents+json' \
http://localhost:3000/
http://localhost:3000/v02
```
__A Binary One__
@ -41,7 +115,7 @@ curl -X POST \
-H'ce-source:https://github.com/cloudevents/spec/pull/123' \
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
-H'ce-time:2019-06-21T17:31:00Z' \
http://localhost:3000/
http://localhost:3000/v02
```
__A Binary One with Extension__
@ -56,7 +130,7 @@ curl -X POST \
-H'ce-id:45c83279-c8a1-4db6-a703-b3768db93887' \
-H'ce-time:2019-06-21T17:31:00Z' \
-H'ce-my-extension:extension value' \
http://localhost:3000/
http://localhost:3000/v02
```
__A Batch One__