KevinDelao / Cloud-Backend-Project

0 stars 0 forks source link

Have the C++ program (data collector) call back-end cloud services #23

Closed jsunthon closed 4 years ago

jsunthon commented 4 years ago

Steps:

1) Make REST API call to the GET /v1/user?username=jsunthon endpoint to see if the user with the given username exists, then if it does exist, you'll get back:

{
  "userId": "f5301d4a-31be-48a8-92d4-7e826f3cc447",
  "username": "jsunthon",
  "firstName": "james",
  "lastName": "sunthonlap",
  "devices": [],
  "gameSessions": []
}

If you receive HTTP status 404, it means it doesn't exist, so call the POST /v1/user endpoint to create the user with that username with the following request JSON body:

{
  "username": "jsunthon",
  "firstName": "James",
  "lastName": "Sunthonlap"
}

and then you'll get back:

{
  "userId": "f5301d4a-31be-48a8-92d4-7e826f3cc447",
  "username": "jsunthon",
  "firstName": "james",
  "lastName": "sunthonlap",
  "devices": [],
  "gameSessions": []
}

2) Make REST API call to the GET /v1/device?name=james_device endpoint to see if a device with the given name exists.

If it exists, you'll get back:

{
  "deviceId": "23f32d3c-08ff-498f-bcac-584ecf320cb2",
  "name": "james_device"
}

If you receive HTTP status 404, it means it doesn't exist, so call the POST /v1/device endpoint to create the device with that name with the following request JSON body:

{
   "name": "james_device"
}

and you'll then get back:

{
  "deviceId": "23f32d3c-08ff-498f-bcac-584ecf320cb2",
  "name": "james_device"
}

3) Make a REST API call to create a game session to the POST /v1/game-session endpoint with the following request JSON body:

{
  "userId": "f5301d4a-31be-48a8-92d4-7e826f3cc447"
}

and you'll then get back:

{
  "gameSessionId": "515a9332-86b4-4e36-a809-42fdeb2b9449",
  "creationDateTime": null,
  "calibrationStage": "string",
  "score": 0,
  "rounds": 0,
  "wordsCorrect": 0,
  "totalWords": 0,
  "totalWrongWords": 0,
  "objectsHit": 0,
  "baseline": 0,
  "speed": 0
}

4) Make REST API call to create the position event to the POST /v1/position-event endpoint , for every position event that is generated, with the following request body:

{
  "deviceId": "23f32d3c-08ff-498f-bcac-584ecf320cb2",
  "gameSessionId": "515a9332-86b4-4e36-a809-42fdeb2b9449",
  "x": 10,
  "y": 66,
  "z": 40
}
jvelasco2319 commented 4 years ago

got the bare-bones code to work and receive an HTTP code 200 based on the HTTP request for all users http://vr-rehab-cloud-service-usc-dev.us-east-2.elasticbeanstalk.com/v1/user/all

HTTP Code 200

jsunthon commented 4 years ago

Had a meeting today and looks like this is 90% done. @jvelasco2319 reported he just has to parse the id values and pass them to the API calls automatically.

Also need to be executing the while loop that gets the new position events and makes the API call to create it.