OpenFn / unicef-cambodia

UNICEF Cambodia - Primero Interoperability
https://openfn.github.io/unicef-cambodia/
1 stars 2 forks source link

custom response handler for Oscar POST requests #114

Closed aleksa-krolls closed 1 year ago

aleksa-krolls commented 2 years ago

Request

To control the API request responses and error messages logged in OpenFn for enhanced error-handling. See slack thread for the concept: https://openfn.slack.com/archives/D017F1BESP6/p1655052600211659

state

Configuration: See LP for Oscar Staging (api only user)

  1. You only need this configuration for the f2-j1 job.
  2. For the f1-j2 job, run the related f1-j1 job using the Primero Demo creds Primero Alpha Cambodia V1 - Staging API user to generate state for j2.

expression

Apply this change in 2 Oscar jobs that run on Primero V1:

  1. https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/f2-j1-getOscarCases.js
  2. https://github.com/OpenFn/unicef-cambodia/blob/master/jobs/f1-j2-casesToOscar.js

adaptor

http v4.0.0

To Test

Feel free to run tests in the staging environment, but not 100% sure you will be able to replicate this failure on staging. If not, keep me posted and I might suggest actions to force a failure (e.g., sending the wrong credential).

See existing run as an example run log that we would want to modify.

taylordowns2000 commented 2 years ago

@aleksa-krolls , check out PR #115 - I think it does the trick, though the resulting error logs are super sparse. If you're OK with only logging the error code, message, and data key from the Oscar response, these look good.

aleksa-krolls commented 2 years ago

@taylordowns2000 see my comments on the PR - I think we need to consider the custom logging requirement.