Skip to content

POST Request For Events

Alex edited this page Mar 17, 2019 · 9 revisions

For AWS API setup see this link.

POST event object to DynamoDB

GET example curl:

curl -v -X GET https://api.2edusite.com/v1/events

POST example curl:

curl -H "Content-Type:application/json" -X POST -d '{"user_name":"Enshaedn","event_name":"Class Demo","event_link":"actokids.org","activity_type":"Art","description":"Demo of POST method to DynamoDB - updated.","org_name":"NSC","location_name":"North Seattle College","location_address":"1280 Harrison St, Seattle, WA 98109","contact_name":"Alex","contact_phone":"206-579-6806","contact_email":"alexclontz@enshaedn.com","start_date_time":"2019-02-13T18:00:00.000Z","end_date_time":"2019-02-13T20:45:00.000Z","frequency":"Weekly","cost":0.00,"picture_url":"none","min_age":20,"max_age":50,"disability_types":["Mobility"],"inclusive_event":true,"event_status":"Declined","approver":"Toddy"}' https://api.2edusite.com/v1/events

Important curl notes:

  • POST curl only works on Mac/Linux. I couldn't get it to work in Windows CMD.
  • POST curl function will work multiple times and return the new event_id each time.
  • GET curl shows that an event has previously been posted to DynamoDB.
  • GET by event_id works; Can add /{event_id} to the URL to see the specific event just created.

Things to consider moving forward:

Sprint 2:

  • DynamoDB can't auto-increment a field like a relational (i.e. MySQL) DB can. Switched to UUID for the time being.
  • API Gateway model needs more updating. Swagger suggests formats/patterns for some parameters, but I couldn't get all of them working properly with API Gateway.
  • OpenAPI 3.0 says nullable: true is a valid parameter field, but I couldn't get it to work in Swagger or API Gateway. Wanted to use it for the picture_url so that null could be passed instead of "none" since "" gets rejected in API Gateway.
  • API response codes need work to match Swagger. Didn't have enough time to figure those out.

Sprint 3:

  • API Gateway model updated slightly. Needs to be shared/implemented across the team and update here.
  • Team needs to determine standard for API Gateway -> Lambda integration (proxy vs passthrough).
  • Need to set standards for logging and start planning on best ways to merge code
  • Need additional Lambda functions created in class AWS probably - 4 total (/events, /events/{event_id}, /events/filterEvents, and a recurrence function updater).

Sprint 5:

  • API moved and setup in prod region.
  • API Gateway model updated slightly to include an "inclusive" parameter.
  • Team decided on API Gateway -> Lambda via passthrough.
  • Prod CloudWatch logging is working and the dashboard is created.

Clone this wiki locally