unee-t / frontend

Meteor front end
https://case.dev.unee-t.com/
GNU Affero General Public License v3.0
9 stars 17 forks source link

Create case 3rd party API #854

Closed nbiton closed 5 years ago

nbiton commented 5 years ago

Resolves #779

The API endpoint is POST /api/cases Example request body:

{
    "apiKey": "Mq9wLSeim7iusbqMeO9yUGao",
    "unitId": "THNMpfpMeRhZ2bLnU",
    "title": "test api 2",
    "details": "detailssssss",
    "assignedRole": "Tenant",
    "category": "Electrical",
    "subCategory": "Maintenance",
        "assigneeId": "e6mFnhN6HtT6tSguh"
}

Example response body: (Contains the new case's id)

{
    "id": 73464
}

This example is also saved in our Postman account under "Uneet" -> "Case / MEFE / Frontend" -> "Create case via MEFE 3rd party API"

franck-boullier commented 5 years ago

Thanks @nbiton. How does this work when the id of the unit is the unit alias instead of the mefe unit id?

franck-boullier commented 5 years ago

@nbiton can you also document how to include additional fields like solution, deadline, next step date, etc... in the payload when we create a new case?

franck-boullier commented 5 years ago

"assigneeId": "e6mFnhN6HtT6tSguh"

Is this the assignee mefe id or is it the assignee api key?

Is there a way to use an alias for the assignee (same idea as using an alias for the unit id)?

nbiton commented 5 years ago

@nbiton can you also document how to include additional fields like solution, deadline, next step date, etc... in the payload when we create a new case

Those are not currently available. The only fields that are available are those mentioned in #779

nbiton commented 5 years ago

Is this the assignee mefe id or is it the assignee api key?

It's the MEFE user ID

Is there a way to use an alias for the assignee (same idea as using an alias for the unit id)?

Not yet (not a part of this PR)

franck-boullier commented 5 years ago

It's the MEFE user ID

We don't expose that to the users, we only expose the user API key <--- it'll be much easier if we can use the user API Key instead of the MEFE user ID...

nbiton commented 5 years ago

We don't expose that to the users, we only expose the user API key <--- it'll be much easier if we can use the user API Key instead of the MEFE user ID...

That doesn't make a lot of sense. The user's API key is a piece privileged information that allows you to perform different actions on behalf of the user. Referencing an assignee definitely doesn't fall into that category. A reporter of a case should not have the access to the assignee's API key by default, but the ID is publicly available, and that should be used.