def subjects(self, external_system_id, path=None, organization_id=None): ''' Attempts to get subject records for subjects that have externalrecords on the specified externalsystem Inputs: external_system_id : int value of the externalsystem record id path (optional) : If specified, this will only return Subjects with externalrecords matching this path organization_id (optional) : int value of the organization. If specified, this will only return Subjects belonging to this organization with externalrecords on the externalsystem Outputs: list of Subject objects If no records are found PageNotFound is raised ''' ehb_service_path = self.root_path + 'id/' + str(external_system_id) + '/' if organization_id is None: ehb_service_path += 'subjects/' else: ehb_service_path += 'organization/' + str(organization_id) + '/subjects/' if path: ers = self.external_records(external_system_id, path=path, organization_id=organization_id) response = self.processGet(ehb_service_path) status = [] for o in json.loads(response): s = Subject.identity_from_jsonObject(o) if path is None: status.append(s) else: for er in ers: if er.subject_id == s.id and not status.__contains__(s): status.append(s) if len(status) == 0: raise PageNotFound(ehb_service_path) else: return status