unee-t / frontend

Meteor front end

Home Page:https://case.dev.unee-t.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

API to create a case

franck-boullier opened this issue · comments

How it should work:

  • 3rd party calls an endpoint

Input:

  • MEFE Unit ID: the MEFE Id for the unit.
  • API Key for the User reporting the case (Reporter)
  • Case Title
  • Case Description (optional)
  • Case Category (Optional): one of the valid case category. See #846 on how to get the list of active Category.
  • Case Type (Optional): One of the active case types for the case category that has been selected. See #846 on how to get the list of active Case Types.
  • Role: One of the roles that the user is allowed to see for this unit.
  • Assignee (Optional): The API key for the user that needs to be assigned to this case. It could be the Reporter or another API key for another user if needed.

Response:

Success:

  • Case number.

Error:

Meaningful error message.

The API in its final form will work as follows:

Request

{
	"apiKey": String, // API key for the user who's reporting the case, or for the creator of the user specified by 'reporterId'
        "reporterId": String, // (Optional) The MEFE ID of the user who is assumed as the reporter of this case. The user specified by this attribute must have been created by the user associated with 'apiKey'. This should be used in conjunction with 'reporterAliasId'
        "reporterAliasId": String, // (Optional) The alias ID in the context of the user specified by 'apiKey', of the user assumed as the reporter of this case. Works the same way as 'reporterId' in any other aspect.
	"unitId": String, // (Optional) The MEFE ID of the unit. If this is not provided, 'unitAliasId' is mandatory
        "unitAliasId": String, // (Optional) The alias ID of the unit in the context associated with the user specified by 'apiKey'. If this is not provided, 'unitId' is mandatory
	"title": String, // The title for the case
	"details": String, // (Optional) The details of the case. This shows up as the first comment of the case. If not provided, 'title' is shown as the first comment of the case.
	"assignedRole": String, // Enum of "Tenant", "Owner/Landlord", "Agent", "Management Company" (The "Contractor" role is excluded)
	"category": String, // (Optional) Enum of category types
	"subCategory": String, // (Optional) Enum of sub category types. Each 'category' has its own set of sub category types.
	"assigneeId": String, // (Optional) The MEFE ID of the user who should be the assignee of the case. This should only be used if the desired assignee is not the default assignee for the role specified under 'assignedRole', but one the same roles other members.
        "assigneeAliasId": String // (Optional) The alias ID of the user who'll be assigned to this case, in the context of the user specified by 'apiKey'. Works the same as 'assigneeId' in any other aspect.
}

Response:

{
        "id": Number // The ID of the newly created case
}