diff --git a/api/reviewer_api/resources/document.py b/api/reviewer_api/resources/document.py index 6963a20a8..5bb003df4 100644 --- a/api/reviewer_api/resources/document.py +++ b/api/reviewer_api/resources/document.py @@ -95,7 +95,8 @@ def get(requestid): timeout=float(requestapitimeout) ) response.raise_for_status() - result = documentservice().getdocuments(requestid) + bcgovcode = response.json()['bcgovcode'] + result = documentservice().getdocuments(requestid,bcgovcode) return json.dumps(result), 200 except KeyError as err: return {'status': False, 'message':err.messages}, 400 diff --git a/api/reviewer_api/services/documentservice.py b/api/reviewer_api/services/documentservice.py index a197d53a1..b6618c354 100644 --- a/api/reviewer_api/services/documentservice.py +++ b/api/reviewer_api/services/documentservice.py @@ -291,13 +291,13 @@ def updatedocumentattributes(self, payload, userid): return DocumentAttributes.update(newRows, oldRows) - def getdocuments(self, requestid): + def getdocuments(self, requestid,bcgovcode): divisions_data = requests.request( method='GET', - url=requestapiurl + "/api/foiflow/divisions", + url=requestapiurl + "/api/foiflow/divisions/{0}".format(bcgovcode), headers={'Authorization': AuthHelper.getauthtoken(), 'Content-Type': 'application/json'} ).json() - divisions = {div['divisionid']: div for div in divisions_data} + divisions = {div['divisionid']: div for div in divisions_data['divisions']} documents = {document['documentmasterid']: document for document in self.getdedupestatus(requestid)} attachments = []