/** * Delete all collaborators. If the indicated patient record doesn't exist, or if the user sending the request * doesn't have the right to manage the target patient record, no change is performed and an error is returned. * * @param patientId internal identifier of a patient record * @return a status message */ @DELETE @RequiredAccess("manage") Response deleteAllCollaborators(@PathParam("patient-id") String patientId); }
/** * Delete a patient record, identified by its internal PhenoTips identifier. If the indicated patient record doesn't * exist, or if the user sending the request doesn't have the right to delete the target patient record, no change * is performed and an error is returned. * * @param id the patient's internal identifier, see {@link org.phenotips.data.Patient#getId()} * @return a status message */ @DELETE @RequiredAccess("edit") Response deletePatient(@PathParam("entity-id") String id); }
/** * Import one or more patients from their JSON representation. * * @param json the JSON representation of the new patient(s) to add * @return the location of the newly created patient if one patient was created and the operation was successful, * null upon successful creation of several patients, and an error report otherwise */ @Consumes(MediaType.APPLICATION_JSON) @POST @RequiredAccess("edit") Response add(String json);
/** * Retrieve information about the collaborators. If the indicated patient record doesn't exist, or if the user * sending the request doesn't have the right to view the target patient record, an error is returned. * * @param patientId internal identifier of a patient record * @return REST representation of a collection of collaborators */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") CollaboratorsRepresentation getCollaborators(@PathParam("patient-id") String patientId);
/** * Retrieve the {@link org.phenotips.data.permissions.Visibility} of a patient identified by `patientId`. If the * indicated patient record doesn't exist, or if the user sending the request doesn't have the right to view the * target patient record, an error is returned. * * @param patientId identifier of the patient whose visibility to retrieve * @return a representation of the visibility of the patient */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") VisibilityRepresentation getVisibility(@PathParam("patient-id") String patientId);
/** * Retrieves the owner of a patient record - which is found by the passed in patient identifier - if the indicated * patient record doesn't exist, or if the user sending the request doesn't have the right to view the target * patient record, an error is returned. * * @param patientId internal identifier of a patient record * @return REST representation of an owner of a patient record */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") OwnerRepresentation getOwner(@PathParam("patient-id") String patientId);
/** * Retrieves all permissions: owner, collaborators, visibility. If the indicated patient record doesn't exist, or if * the user sending the request doesn't have the right to view the target patient record, an error is returned. * * @param patientId internal identifier of a patient record * @return REST representation of the permissions of a patient record */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") PermissionsRepresentation getPermissions(@PathParam("patient-id") String patientId);
/** * Retrieves a list of all consents for a given patient. * * @param patientId of a record whose consents to retrieve * @return a JSON array of all consents if the user is allowed to do so and such a record exists, otherwise a failed * response. */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") Response getConsents(@PathParam("patient-id") String patientId);
/** * Retrieve a patient record, identified by its internal PhenoTips identifier, in its JSON representation. If the * indicated patient record doesn't exist, or if the user sending the request doesn't have the right to view the * target patient record, an error is returned. * * @param id the patient's internal identifier, see {@link org.phenotips.data.Patient#getId()} * @return the JSON representation of the requested patient, or a status message in case of error */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") Response getPatient(@PathParam("entity-id") String id);
/** * Update all collaborators, replacing all previous collaborators. If the indicated patient record doesn't exist, or * if the user sending the request doesn't have the right to manage the target patient record, no change is * performed and an error is returned. * * @param collaborators a list of collaborators, each of which must have {@code id} and {@code level} properties * @param patientId internal identifier of a patient record * @return a status message */ @PUT @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response setCollaborators(CollaboratorsRepresentation collaborators, @PathParam("patient-id") String patientId);
/** * Updates the owner of a patient record - identified by `patientId` - with the owner specified in JSON. If the * indicated patient record doesn't exist, or if the user sending the request doesn't have the right to edit the * target patient record, no change is performed and an error is returned. * * @param owner an owner representation, only the {@code id} property is required, with a value of either a fully * qualified username or a plain username (eg. {@code xwiki:XWiki.username} or {@code username}) * @param patientId identifier of the patient whose owner should be changed * @return a status message */ @PUT @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response setOwner(OwnerRepresentation owner, @PathParam("patient-id") String patientId);
/** * Updates the owner of a patient record - identified by `patientId` - with the owner specified in JSON. If the * indicated patient record doesn't exist, or if the user sending the request doesn't have the right to edit the * target patient record, no change is performed and an error is returned. The request must contain an "owner" * field. * * @param patientId identifier of the patient, whose owner should be changed * @return a status message */ @PUT @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response setOwner(@PathParam("patient-id") String patientId); }
/** * Reindex the whole vocabulary, fetching the source from the specified location, or from its * {@link Vocabulary#getDefaultSourceLocation() default source location}. This request must come from an * administrator. * * @param vocabularyId the vocabulary to be indexed; will return an error if the vocabulary cannot be resolved * @param sourceUrl the URL to be indexed, optional * @return a {@link Response} indicating whether the indexing was successful */ @POST @RequiredAccess("admin") Response reindex(@PathParam("vocabulary-id") String vocabularyId, @QueryParam("url") String sourceUrl); }
/** * Update the visibility of a patient. If the indicated patient record doesn't exist, or if the user sending the * request doesn't have the right to edit the target patient record, no change is performed and an error is * returned. The request must contain a "visibility" parameter, with a valid visibility level name as the value. * * @param patientId identifier of the patient whose visibility should be changed * @return a status message */ @PUT @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response setVisibility(@PathParam("patient-id") String patientId); }
/** * Update the visibility of a patient. If the indicated patient record doesn't exist, or if the user sending the * request doesn't have the right to edit the target patient record, no change is performed and an error is * returned. * * @param visibility which must contain "level" parameter, with a valid visibility level name as the value * @param patientId identifier of the patient whose visibility should be changed * @return a status message */ @PUT @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_JSON) Response setVisibility(VisibilityRepresentation visibility, @PathParam("patient-id") String patientId);
/** * For granting a single consent in a patient record. * * @param patientId of the record which is to be affected * @param id of the consent to grant * @return response with code 200 if successful, or a response with a non-successful code */ @PUT @Path("/grant") @Consumes(MediaType.TEXT_PLAIN) @RequiredAccess("edit") Response grantConsent(@PathParam("patient-id") String patientId, String id);
/** * Retrieves the owner of an entity record - which is found by the passed in entity identifier - if the indicated * entity record doesn't exist, or if the user sending the request doesn't have the right to view the target * entity record, an error is returned. * * @param entityId internal identifier of an entity record * @param entityType the type of entity (either "patients" or "families") * @return REST representation of an owner of an entity record */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") OwnerRepresentation getOwner(@PathParam("entity-id") String entityId, @PathParam("entity-type") String entityType);
/** * Retrieves all permissions: owner, collaborators, visibility. If the indicated entity record doesn't exist, or if * the user sending the request doesn't have the right to view the target entity record, an error is returned. * * @param entityId internal identifier of an entity record * @param entityType the type of entity (either "patients" or "families") * @return REST representation of the permissions of an entity record */ @GET @Produces(MediaType.APPLICATION_JSON) @RequiredAccess("view") PermissionsRepresentation getPermissions(@PathParam("entity-id") String entityId, @PathParam("entity-type") String entityType);
/** * For revoking a single consent in a patient record. * * @param patientId of the record which is to be affected * @param id of the consent to revoke * @return response with code 200 if successful, or a response with a non-successful code */ @PUT @Path("/revoke") @Consumes(MediaType.TEXT_PLAIN) @RequiredAccess("edit") Response revokeConsent(@PathParam("patient-id") String patientId, String id);
/** * Update the visibility of an entity. If the indicated entity record doesn't exist, or if the user sending the * request doesn't have the right to edit the target entity record, no change is performed and an error is * returned. The request must contain a "visibility" parameter, with a valid visibility level name as the value. * * @param entityId identifier of the entity whose visibility should be changed * @param entityType the type of entity (either "patients" or "families") * @return a status message */ @PUT @RequiredAccess("manage") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response setVisibility(@PathParam("entity-id") String entityId, @PathParam("entity-type") String entityType); }