# Having trouble sending downlink with HTTP Integration

**URL:** <https://www.thethingsnetwork.org/forum/t/having-trouble-sending-downlink-with-http-integration/38217>\
**Category:** Application Development\
**Created:** [July 1, 2020, 9:17am UTC](https://www.thethingsnetwork.org/forum/t/having-trouble-sending-downlink-with-http-integration/38217 "2020-07-01T09:17:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lWalter](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/lwalter/32/25844_2.png) [@lWalter](https://www.thethingsnetwork.org/forum/u/lWalter)\
**Post date:** [July 1, 2020, 9:17am UTC](https://www.thethingsnetwork.org/forum/t/having-trouble-sending-downlink-with-http-integration/38217/1 "2020-07-01T09:17:00Z")

</div>

Hello,  
I am trying to schedule a downlink via curl. I read the documentation on http on the ttn website.  
My curl command looks like this:  
curl -X POST --data ‘{“dev\_id”:“td00”, “payload\_raw”:“dGVzdA==”}’ [https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/my-app-id/my-process-id?key=ttn-account-v2.secret](https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/my-app-id/my-process-id?key=ttn-account-v2.secret)

Now I have trouble scheduling the downlink. I see nothing in my ttn-console. I replaced the “my-app-id” in the url with my Application ID, the “my-process-id” with “request\_bin\_test” (the id I gave the http integration) and “secret” at the end of the url with my Access Key.

I created a URL for the http integration with [requestbin.net](http://requestbin.net). Receiving uplinks works just fine.  
I never used curl or http protocoll before so I don’t know if I missunderstood the documentation. Are there problems with \_ ? or = in the url? I use curl via the Windows terminal and get no error or anything when I execute the command.

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [July 1, 2020, 10:24am UTC](https://www.thethingsnetwork.org/forum/t/having-trouble-sending-downlink-with-http-integration/38217/2 "2020-07-01T10:24:00Z")

</div>

Use `curl -i` or even `curl -v` to see the response. I guess you’ll be seeing 401 Unauthorized:

> [@lWalter](#):
>
> “secret” at the end of the url with my Access Key

You should not replace just the word `secret`, but all of `ttn-account-v2.secret`.

This works for me, though it defaults to port 0:

```plaintext
curl -i -X POST --data '{"dev_id": "arjanvanb-ttnode-1", "payload_raw": "dGVzdA=="}' https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/arjanvanb-app-ttnode/arjanvanb-http-ttnnode?key=ttn-account-v2.kFd<redacted>Vi_il4

HTTP/1.1 202 Accepted
Server: nginx/1.13.7
Date: Wed, 01 Jul 2020 10:20:50 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive

```

 ![Application data](https://www.thethingsnetwork.org/forum/uploads/default/original/3X/7/d/7dee7c8e4a8ab3bab21907256434eb9197c1fc7e.png)

⚠ Port 0 is reserved for MAC commands without an application payload, so you should also include `"port": 1` or another value in the JSON data. Not doing so, it seems TTN will (currently) use the same port that was used for the uplink. But that’s undocumented behaviour, so surely it’s better to be explicit instead.

Note that the full downlink URL that you need is also in each uplink message that is posted by the HTTP Integration. So, you should see that on RequestBin.

(Aside, I know it’s just a test, but: don’t send text. Not even for a test.)

---

<div class="post-metadata">

**Author:** ![lWalter](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/lwalter/32/25844_2.png) [@lWalter](https://www.thethingsnetwork.org/forum/u/lWalter)\
**Post date:** [July 3, 2020, 3:30pm UTC](https://www.thethingsnetwork.org/forum/t/having-trouble-sending-downlink-with-http-integration/38217/3 "2020-07-03T15:30:20Z")

</div>

Thanks for the answer!  
I used curl with -i and -v and used the url that came with my uplink. It still doesn’t work and I get a http 400 Bad Request error. I also tried using `-H "Content-Type: application/json"` because to my understanding the data is encoded in json?  
My output log in terminal is as follows:

> HTTP/1.1 400 Bad Request  
> Server: nginx/1.13.7  
> Date: Fri, 03 Jul 2020 15:21:13 GMT  
> Content-Type: text/plain; charset=utf-8  
> Content-Length: 0  
> Connection: keep-alive

My curl command:

> curl.exe -i -v -X POST -d ‘{“dev\_id”:“td00”, “port”:1, “payload\_raw”:“AQIDBA==”}’ [https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/idt00/request\_bin\_test?key=](https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/idt00/request_bin_test?key=)(APP ACCES KEY)

I also tried it without any “payload\_raw” and it didn’t work. Could you also elaborate your last point about not sending text for my payload?  
Thanks!

---

<div class="post-metadata">

**Author:** ![arjanvanb](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/arjanvanb/32/46626_2.png) [@arjanvanb](https://www.thethingsnetwork.org/forum/u/arjanvanb)\
**Post date:** [July 3, 2020, 3:37pm UTC](https://www.thethingsnetwork.org/forum/t/having-trouble-sending-downlink-with-http-integration/38217/4 "2020-07-03T15:37:46Z")

</div>

> [@lWalter](#):
>
> curl.exe -i -v -X POST -d ‘{“dev\_id”: …

See [Using curl or Postman for the HTTP Integration on Windows](https://www.thethingsnetwork.org/forum/t/using-curl-or-postman-for-the-http-integration-on-windows/12467).

> [@lWalter](#):
>
> Could you also elaborate your last point about not sending text for my payload?

See [Best practices to limit application payloads](https://www.thethingsnetwork.org/forum/t/best-practices-to-limit-application-payloads/1302).
