Description
This API describes the different resources that are available in the PetOwner API. This API is consumed by the MyPets backend.
Authentication
All calls to the API require that a basic authentication string is present in the request with a username/password combination for a user that has the role FUGAPETOWNER. Currently the MYPETS user fulfills this role.
Besides authentication we also use an X-Application-Key header for auditing. The acceptable keys can be found in the fuga.properties file under the petOwnerApi key.
Endpoints
The base URL for the API is: https://(test2.)sonetas.eu/fuga/rest/petowner
AgendaResource
createAppointment
POST /appointments/{practiceId}/{clientUsername}
With URL request params:
- practiceId -> integer value of the practice to which the user belongs
- clientUsername -> myPetsUsername of the user
With request body:
{ "date": string (yyyy-MM-dd), "beginTime": string (HH:mm), "endTime": string (HH:mm), "patientId": int "description": string, "vetId": int, "consultationRoomId": int, "sendReminder": string (EWrittenContactMediumPreference.class) - optional }
Has response:
- HTTP 200 with data:
{ "id": int }
With potential errors:
- HTTP 400 if the request body has validation/parsing errors
- HTTP 409 if the selected slot is no longer available
- HTTP 500 for any other internal error
deleteAppointment
DELETE /appointments/{practiceId}/{clientUsername}/{personId}/{appointmentId}
With URL request params:
- practiceId -> integer value of the practice to which the user belongs
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
- appointmentId -> integer value of the appointment to delete
Has response:
- HTTP 200 without data
With potentials errors:
- HTTP 404 if the appointment with appointmentId cannot be found
- HTTP 500 for any other internal error
getAgendaSlotsBetweenDates
GET /agendaPublicSlots/{practiceId}
With URL request params:
- practiceId -> integer value of the practiceId to which the user belongs
With URL query params:
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
- startDate -> string value of the start date in format yyyy-MM-dd
- endDate -> string value of the end date in format yyyy-MM-dd
Has response:
- HTTP 200 with data:
{ "slots": [ { "type": { "id": int, "nameTDutch": string, "nameTFrench": string, "nameTEnglish": string, "duration": int, "species": string (ESpecies.class) - optional }, "data": [ { "date": string (yyyy-MM-dd), "beginTime": string (HH:mm), "endTime": string (HH:mm), "state": string (EAgendaPublicSlotState.class), "vet": string, "vetId": int, "consultationRoomId": int, "publicLocationId": int } ] } ] }
With potential errors:
- HTTP 400 in case startDate or endDate is NULL
- HTTP 500 for any other internal error
getAppointments
GET /appointments/{practiceId}/{clientUsername}/{personId}
With URL request params:
- practiceId -> integer value of the practiceId to which the user belongs
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
With URL query params:
- startDate -> string value of the start date in format yyyy-MM-dd
- endDate -> string value of the end date in format yyyy-MM-dd
Has response:
- HTTP 200 with data:
{ "appointments": [ { "id": int, "date": string (yyyy-MM-dd), "beginTime": string (HH:mm), "endTime": string (HH:mm), "type": string (EBciType.class), "state": string (EAgendaPublicSlotState.class), "description": string - optional, "vet": string, "vetId": int, "patientId": int - optional, "patientName": string - optional, "locationName": string, "locationId": int, "consultationRoomId": int, "consultationRoom": string, "registrationDate": string (yyyy-MM-dd) - optional, "registrationTime": string (HH:mm) - optional } ] }
With potential errors:
- HTTP 500 for any internal error
ClientsResource
addDeviceToken
POST /clients/deviceToken/{practiceId}/{clientUsername}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
With request body:
{ "type": string (EDeviceTokenType.class), "identifier": string }
Has response:
- HTTP 200 without data
With potential errors:
- HTTP 400 if the request body has validation/parsing errors
- HTTP 500 for any other internal error
getClient
GET /clients/{practiceId}/{clientUsername}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
Has response:
- HTTP 200 with profile of the user (no example shown because it's very long and many things are optional)
With potential errors:
- HTTP 500 for any other internal error
getMessages
GET /messages/{practiceId}/{clientUsername}/{personId}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
Has response:
- HTTP 200 with data:
{ "messages": [ { "id": int, "source": string, "sourceType": string (EMyPetsMessageSource.class), "messageType": string (EMyPetsMessageType.class), "source": string, "modifiedDateTime": string (yyyy-MM-dd'T'HH:mm:ss), "read": boolean, "title": string, "contentHtml": string, "marketing": boolean } ] }
With potential errors:
- HTTP 500 for any other internal error
login
POST /clients/login
With request body:
{ "username": string, "password": string, "practiceIds": string[] }
Has response:
- HTTP 200 without data
With potential errors:
- HTTP 401 if there is no username/password combination that matches for any of the provided practiceIds
messageRead
PUT /clients/{practiceId}/{clientUsername}/{personId}/{messageId}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
- messageId -> integer value of the id of the message you wish to mark as read
Has response:
- HTTP 200 without data
With potential error:
- HTTP 500 for any other internal error
register
POST /clients/{practiceId}
With URL request params:
- practiceId -> integer value of the practice for which the registration should be completed
With URL query params:
- returnFullProfile -> whether or not to return the full profile (default: false)
With request body:
{ "email": string, "password": string, "title": string (EPersonTitle.class), "firstName": string, "lastName": string, "language": string (ELanguage.class), "streetAndNumber": string, "city": string, "zipCode": string, "country": string (ECountry.class), "phone": string, "gsm": string, "alreadyClient": boolean }
Has response:
- HTTP 200 with either full profile or simply the personId if returnFullProfile was false.
With potential errors:
- HTTP 400 if the request body has validation/parsing errors
- HTTP 406 if the password is not considered secure enough
- HTTP 409 if there already exists a user with that email address
- HTTP 500 for any other internal error
updateClient
PUT /clients/{practiceId}/{clientUsername}/{personId}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
With URL query params:
- returnFullProfile -> whether or not to return the full profile (default: false)
With request body:
{ "title": string (EPersonTitle.class), "firstName": string, "lastName": string, "language": string (ELanguage.class), "streetAndNumber": string, "city": string, "zipCode": string, "country": string (ECountry.class), "dateOfBirth": string (yyyy-MM-dd), "language": string (ELanguage.class), "showOnlyNormalAnimals": boolean, "contactMedia": [ { "type": string (EContactMedium.class), "identifier": string } ], "sendMailing": string (EWrittenContactMediumPreference.class), "sendFinancialDocs": string (EWrittenContactMediumPreference.class), "sendTreatmentReminder": string (EWrittenContactMediumPreference.class), "sendConsultationAppointmentConfirmation":string (EWrittenContactMediumPreference.class), "sendConsultationAppointmentReminder": string (EWrittenContactMediumPreference.class), "sendMyPetsMessageNotification": string (EWrittenContactMediumPreference.class), "allowMarketingMessages": boolean, "allowStatsToThirdParties": boolean, "newClientUsername": string }
Has response:
- HTTP 200 with either full profile or simply the personId if returnFullProfile was false.
With potential errors:
- HTTP 304 if the practice does not allow a client with outstanding payments to update their details
- HTTP 400 in case the newUsername is already in use
- HTTP 400 if the request body has validation/parsing errors
- HTTP 500 for any other internal error
updateOrCreateAnimal
PUT /animals/{practiceId}/{clientUsername}/{personId}/{animalId}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
- personId -> integer value of the id of the associated Person record in Fuga
- animalId -> integer value of the id of the animal you wish to edit (0 if adding a new animal)
With URL query params:
- returnFullProfile -> whether or not to return the full profile (default: false)
With request body:
{ "name": string, "dateOfBirth": string (yyyy-MM-dd) - optional, "species": string (ESpecies.class) - optional, "breedId": int (0 is unset) - optional, "sex": string (ESex.class) - optional, "sterilized": string (ESterilized.class) - optional, "register": string - optional, "passport": string - optional, "pictureFilename": string - optional, "pictureData": string (base64 encoded) - optional }
Has response:
- HTTP 200 with either full profile or simply the personId if returnFullProfile was false.
With potential errors:
- HTTP 400 if the request body has validation/parsing errors
- HTTP 500 for any other internal error
PracticeResource
getCommonInfo
GET /practices/commonInfo
Has response:
- HTTP 200 with data:
{ "animalClasses": [ { "class": string (EAnimalClass.class), "species": [ string (ESpecies.class) ] } ] }
With potential errors:
- HTTP 500 for any other internal error
getPractice
GET /practices/{practiceId}
With URL request params:
- practiceId -> integer value of the practice
Has response:
- HTTP 200 with practice profile data (see eu.sonetas.fuga.rs.server.petowner.PracticesResource#appendJson for full list of returned properties)
With potential errors:
- HTTP 500 for any other internal error
getPractices
GET /practices
Has response:
- HTTP 200 with list of practices (see eu.sonetas.fuga.rs.server.petowner.PracticesResource#appendJson for full list of returned properties)
With potential errors:
- HTTP 500 for any other internal error
ShopResource
createOrder
POST /orders/{practiceId}/{clientUsername}
With URL request params:
- practiceId -> integer value of the practice the user belongs to
- clientUsername -> myPetsUsername of the user
With request body:
{ "orders": [ { "productId": int, "patientId": int, "nbr": int, "listPrice": double, "description": string } ] }
Has response:
- HTTP 200 with data:
{ "ids": [ int ] }
With potential errors:
- HTTP 400 if the request body has validation/parsing errors
- HTTP 500 if there is an error sending the confirmation mail
- HTTP 500 for any other internal error