# POST request with outbound

**URL:** <https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197>\
**Category:** Technical Support\
**Tags:** configuration, interoperability, outbound\
**Created:** [September 23, 2022, 11:05am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197 "2022-09-23T11:05:23Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [September 23, 2022, 11:05am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/1 "2022-09-23T11:05:23Z")

</div>

Hi all,

I was trying to integrate other services e.g. DHIS2 with CHT and for that I was thinking about using openHIM. I defined an outbound (after setting mark\_for\_outbound true) with the url & auth but from the logs of the mediator & platform, it seems like it is performing a GET request. Is there a way to change this to a POST?

---

<div class="post-metadata">

**Author:** ![diana](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/diana/32/2049_2.png) [@diana](https://forum.communityhealthtoolkit.org/u/diana)\
**Post date:** [September 23, 2022, 12:20pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/2 "2022-09-23T12:20:32Z")

</div>

Hi @magp18

From what I can tell from the code, the request is already a `POST`: [cht-core/shared-libs/outbound/src/outbound.js at master · medic/cht-core · GitHub](https://github.com/medic/cht-core/blob/master/shared-libs/outbound/src/outbound.js#L183)

Can you please share logs, or some indication that the request is a GET?  
Thanks!

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [September 23, 2022, 3:25pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/3 "2022-09-23T15:25:51Z")

</div>

@magp18 - Seconding what @diana mentioned, I found it to be a `POST` while I was exploring what an OpenHIM integration might look like in our [CHIS-Interoperability](https://github.com/medic/chis-interoperability/tree/main/DIYM) repo.

Speaking of which, while this code is very nascent (and entirely lacking `;`s !?), it may be helpful, along with our [recently update documentation](https://docs.communityhealthtoolkit.org/apps/concepts/interoperability/), about how to approach an OpenHIM integration.

Let us know how it goes!

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [September 23, 2022, 4:24pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/4 "2022-09-23T16:24:13Z")

</div>

Hi @diana,

 ![image](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/e/ecc142dcede121d41849b4fa4cdc69c3975ce99c.png)

This is from medic-sentinel (CHT is running on docker). I was assuming it was a GET because of the OpenHIM platform (but seems something went wrong before?)

 ![Captura de ecrã 2022-09-23, às 18.16.34](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/f/f484dbcefa919a376ba59e28b311c7184e7d47ce.png)  
Now it’s not triggering the Mediator anymore  
 ![image](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/f/f32963464e14bb071f2eb86b7f6b71d8ea2d6f5e.png)

And the request body was empty somehow. Let me know what other logs are of interest.

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [September 23, 2022, 4:24pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/5 "2022-09-23T16:24:59Z")

</div>

Will have a look on this thanks! And sure will gladly update you on the integration with openHIM:)

---

<div class="post-metadata">

**Author:** ![diana](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/diana/32/2049_2.png) [@diana](https://forum.communityhealthtoolkit.org/u/diana)\
**Post date:** [September 26, 2022, 5:37am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/6 "2022-09-26T05:37:14Z")

</div>

Hi @magp18

I don’t think CHT would make any request if payload mapping failed. Can you please have a look at your outbound configuration and make sure that it follows the documentation? The error would suggest that the `mapping` property is not set. [.outbound | Community Health Toolkit](https://docs.communityhealthtoolkit.org/apps/reference/app-settings/outbound/#configuration)

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [September 26, 2022, 7:07am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/7 "2022-09-26T07:07:01Z")

</div>

Yes you are right, I didn’t realize the mapping property was required, thought I could send the raw data like this directly.

After adding this property I am getting a failed to push error, certificate has expired. Although my certificates seem to be valid.

---

<div class="post-metadata">

**Author:** ![diana](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/diana/32/2049_2.png) [@diana](https://forum.communityhealthtoolkit.org/u/diana)\
**Post date:** [September 26, 2022, 9:02am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/8 "2022-09-26T09:02:22Z")

</div>

The CHT doesn’t do certificate validation. Can you try making a request to your integration server from the server that hosts CHT API and check if the request goes through?

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [September 30, 2022, 9:50am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/9 "2022-09-30T09:50:22Z")

</div>

Thanks for the reply @diana and sorry for the late reply. But yes I think you are right, using 5001 works for me (I have a different error - ESOCKETTIMEOUT) but I think that’s related to my openHIM mapping (there might be an error). I am trying to get it right and will let you know. Thanks anyhow

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [November 23, 2022, 11:46am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/10 "2022-11-23T11:46:39Z")

</div>

Sorry for reviving this post, but it seems like there is something related to the certificate, unless I am missing something.  
I was using 5001 (http) and that was working but changing it back to 5000 (to use https) it still throws me that error “Certificate has expired”.  
Doing the same thing with postman or curling from my CHT server works, however doing it from medic-os docker container fails with

```auto
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none

```

I am mapping my privkey to

```auto
/srv/settings/medic-core/nginx/private/default.key

```

and my fullchain.pem to

```auto
/srv/settings/medic-core/nginx/private/default.crt

```

Do I need to have them somewhere else?

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [November 23, 2022, 1:53pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/11 "2022-11-23T13:53:45Z")

</div>

Upgrading curl in the container, makes that I am able to curl from inside of the container, so seems to me that there is no firewall or certificate issue but I could be wrong. However it still fails when pushing with the error “certificate expired”.

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [November 29, 2022, 10:16am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/12 "2022-11-29T10:16:01Z")

</div>

Seems like this could be related to the ubuntu image used, might be too old (unsure if this is the issue though, but it’s the only thing we can think of right now)

---

<div class="post-metadata">

**Author:** ![diana](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/diana/32/2049_2.png) [@diana](https://forum.communityhealthtoolkit.org/u/diana)\
**Post date:** [November 29, 2022, 10:55am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/13 "2022-11-29T10:55:51Z")

</div>

Definitely! Sorry for not getting back in time.  
Tagging @hareet or @henok for info about MedicOS SSL errors.

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [November 30, 2022, 7:13pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/14 "2022-11-30T19:13:13Z")

</div>

@magp18 - Can you confirm where the “Certificate has expired” error is happening? As I understand it you’re trying to configure CHT with an Outbound push to OpenHIm. So is the CHT reporting that OpenHIE has an invalid certificate? Can you post logs where you see this error so we can get more context? As well, can you confirm the version of CHT you’re on?

Otherwise, to set up a valid certificate on CHT 3.x, you can see the [docs here](https://docs.communityhealthtoolkit.org/apps/guides/hosting/3.x/ssl-cert-install/).

Finally if you want to test with fully valid TLS certificates, it can be helpful to use the freely available wildcard ones at [Local IP](http://local-ip.co/). We even have an automated script to install these for you if you’d like.

The Local IP certificates are for testing and develop ment only - they are insecure by design!

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [December 1, 2022, 7:19am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/15 "2022-12-01T07:19:13Z")

</div>

That is happening inside the medic-os container. As soon as I updated curl I was not having it anymore (curling inside of the container) but I am still getting it after the push is triggered by submitting a form and checking the sentinel logs.  
From the sentinel logs I have this:

 ![image](https://communityhealthtoolkit.b-cdn.net/uploads/default/original/2X/8/80dc87810f1e3fe4e3f402c2c232dbe61bd82452.png)  
I am not sure what other logs I can show you, they seem to not be related but if you now anything that would help, let me know and I will post it.  
I have my certs created with certbot mapped to the right path as mentioned in the first link you sent, are they not fully valid TLS certificates?

---

<div class="post-metadata">

**Author:** ![magp18](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/magp18/32/1319_2.png) [@magp18](https://forum.communityhealthtoolkit.org/u/magp18)\
**Post date:** [December 1, 2022, 7:35am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/16 "2022-12-01T07:35:38Z")

</div>

Do you think we can take out nodejs & nginx in different containers and not in medic-os ? then we could have the latest version and perhaps could help ?

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [December 2, 2022, 9:32pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/17 "2022-12-02T21:32:40Z")

</div>

@magp18 - thank you so much for that screenshot! The `Error: certificate has expired` is super helpful to see.

I set up a dev instance and set two outbound pushes, one to a known expired cert ([https://expired.badssl.com/](https://expired.badssl.com/)) and one to know NOT expired cert ([https://medic.org](https://medic.org)). I thought the first would fail and second would succeed. They BOTH failed 😞 . This is a potential bug, so I’ve [opened a ticket](https://github.com/medic/cht-core/issues/7957) for us to research this.

When I get some more time I’ll see if this persists in CHT 4.

Speaking of CHT 4 - we recommend upgrading! The new [CHT Docker Helper](https://docs.communityhealthtoolkit.org/apps/guides/hosting/4.x/app-developer/#cht-docker-helper-for-4x) is great (I helped write it ;).

Cheers,  
-adj

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [December 3, 2022, 5:13am UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/18 "2022-12-03T05:13:36Z")

</div>

Following up to say I confirmed this problem is **not** present in CHT 4.0.1.

---

<div class="post-metadata">

**Author:** ![mrjones](https://communityhealthtoolkit.b-cdn.net/user_avatar/forum.communityhealthtoolkit.org/mrjones/32/681_2.png) [@mrjones](https://forum.communityhealthtoolkit.org/u/mrjones)\
**Post date:** [January 18, 2023, 6:24pm UTC](https://forum.communityhealthtoolkit.org/t/post-request-with-outbound/2197/19 "2023-01-18T18:24:09Z")

</div>

Following up again to note that a formal, permanent fix has just been merged to `master`. The [patch script is here](https://github.com/medic/cht-core/blob/master/scripts/cht-3x-node-upgrade/upgrade.sh) and [the background ticket is here](https://github.com/medic/cht-core/issues/7957).

We may publish more information about this patch, but I wanted to keep this thread up to date!
