corphiloscience / rocket-lab-test

GNU Affero General Public License v3.0
0 stars 0 forks source link

API Clarification #1

Open jason-burbach opened 2 years ago

jason-burbach commented 2 years ago

Hey Cory! Its Jason Burbach the GDS Tech Lead from Rocket Lab. Thanks for the submission.

I was able to checkout, execute the tests, and run your tech eval, but I could use some clarity on how to interact with the API. I hit localhost:8080 and stepped the urls to get the json data from the LoadDatabase, but I am unsure of how else to interact with it.

Are there other ways to mod and interact with the data?

corphiloscience commented 2 years ago

Hey Jason! Yes you can do the typical operations. Swagger would help with documentation but heres a run down. I wasnt sure what all the data represented so i named them to what i thought made sense. It can be changed easily if needed. Let me know if you need more information!

From http://localhost:8080/

GET /telemetry
Use this to get all the telemetry data

GET /telemetry/1
Used to get telemetry by id

POST /telemetry/bulk
Used to add more than one telemetry at a time
[
    {
        "measurement": "OEM_SCRATE_BDYX",
        "time": "2022-05-13T18:51:10Z",
        "position": "-5.0690708335691E-06",
        "craftId": 2200
    },
    // OEM_SCRATE_BDYX,2022-05-13T18:51:20Z,-4.89050479960237E-06,2200
    {
        "measurement": "OEM_SCRATE_BDYX",
        "time": "2022-05-13T18:51:20Z",
        "position": "-4.89050479960237E-06",
        "craftId": 2200
    }
]

POST /telemetry
Used to add a new telemetry
// OEM_SCRATE_BDYX,2022-05-13T18:51:10Z,-5.0690708335691E-06,2200
Content-Type: application/json
{
    "measurement": "OEM_SCRATE_BDYX",
    "time": "2022-05-13T18:51:10Z",
    "position": "-5.0690708335691E-06",
    "craftId": 2200
}

PUT /telemetry/1
Used to update an existing telemetry based on the id
Content-Type: application/json
Body:
{
    "measurement": "OEM_SCRATE_BDYX",
    "time": "2022-05-13T18:51:10Z",
    "position": "-5.0690708335691E-06",
    "craftId": 2200
}

DELETE /telemetry/1
Used to delete an existing telemetry
jason-burbach commented 2 years ago

Was there a swagger endpoint I can hit with the running app? Or is there a swagger file I can reference?

jason-burbach commented 2 years ago

Also, is the POST and PUT the same if the craftId is the same? I.e is the craftId the primary key?

corphiloscience commented 2 years ago

Was there a swagger endpoint I can hit with the running app? Or is there a swagger file I can reference?

No there is no swagger docs.

Also, is the POST and PUT the same if the craftId is the same? I.e is the craftId the primary key?

The craftId is not a unique ID so it can't be used as a primary key. You have to use the ID that gets generated on POST before calling PUT, GET or DELETE functions. Or use the existing data to make GET, PUT, or DELETE operations.

Let me know if run into any issues when testing. Thanks.