# Downlink from HTTP integration does not show in TTN Console and does not reach my device

**URL:** <https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330>\
**Category:** Application Development\
**Created:** [October 28, 2017, 12:32pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330 "2017-10-28T12:32:51Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![tgrolman](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tgrolman](https://www.thethingsnetwork.org/forum/u/tgrolman)\
**Post date:** [October 28, 2017, 12:32pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/1 "2017-10-28T12:32:51Z")

</div>

I have an application with a device.  
When I send a downlink to my device it doesn’t appear in my console.  
What can be the issue?

I use the commandline to issue the postrequest:

`curl -X POST --data '{"device_id":"my_device", "payload_raw":"AQE="}' https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/my_device/my_integration?key=ttn-account-my_key`

does anyone have a clue?  
thanks Theo.

---

<div class="post-metadata">

**Author:** ![mfalkvidd](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/mfalkvidd/32/46878_2.png) [@mfalkvidd](https://www.thethingsnetwork.org/forum/u/mfalkvidd)\
**Post date:** [October 28, 2017, 10:42pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/2 "2017-10-28T22:42:10Z")

</div>

Does TTN receive the uplink messages from the device? If so, is the rssi near the limit (~-140dB)?

If ttn does not recieve the uplink messages at all, no downlinks can be scheduled.

If the signal from your device to the gateway is too weak, maybe the device is not within range to receive downlinks.

---

<div class="post-metadata">

**Author:** ![tgrolman](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tgrolman](https://www.thethingsnetwork.org/forum/u/tgrolman)\
**Post date:** [October 29, 2017, 10:27am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/3 "2017-10-29T10:27:45Z")

</div>

Thanks for the reply.  
Yes, TTN receives uplink messages from the device.  
And when I send downlink messages to the device via the TTN console, they show up in the console device data (first scheduled, then after an uplink message from the device actually sent) and they reach the device (it causes a led to be turned on).  
But the message send via http (the command line message mentioned above) do not even show up in the the TTN console.

---

<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:** [October 29, 2017, 10:45am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/4 "2017-10-29T10:45:09Z")

</div>

> [@tgrolman](#):
>
> `curl -X POST --data '{"device_id":"my_device", "payload_raw":"AQE="}' https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/my_device/my_integration?key=ttn-account-my_key`

Is that using the exact same URL you get as `"downlink_url"` in the JSON for uplinks? What response do you get from that `curl` command?

Also, [the documentation](https://www.thethingsnetwork.org/docs/applications/http/#with-raw-payload) uses `"dev_id"`, not `"device_id"`, and specifies `"port"` and `"confirmed"`.

---

<div class="post-metadata">

**Author:** ![tgrolman](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tgrolman](https://www.thethingsnetwork.org/forum/u/tgrolman)\
**Post date:** [October 29, 2017, 10:55am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/5 "2017-10-29T10:55:43Z")

</div>

Thanks arjanvanb, that was the solution, I had a typo: the documentation uses “dev\_id”, not “device\_id”.

---

<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:** [October 29, 2017, 10:56am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/6 "2017-10-29T10:56:35Z")

</div>

Did the `curl` command not give you some error from the server then?

---

<div class="post-metadata">

**Author:** ![tgrolman](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/t/848f3c/32.png) [@tgrolman](https://www.thethingsnetwork.org/forum/u/tgrolman)\
**Post date:** [October 29, 2017, 11:04am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/7 "2017-10-29T11:04:49Z")

</div>

No, there was no reply from the server.

---

<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:** [October 29, 2017, 11:42am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/8 "2017-10-29T11:42:16Z")

</div>

> [@tgrolman](#):
>
> there was no reply from the server

That’s impossible; the server will always return some HTTP headers even if it returns no content. But apparently curl did not print anything. For command line testing, better include `-i` to see the response headers: `curl -i -X POST --data ...`. Or `-v` for even more verbose output: `curl -v -X POST --data ...`

---

<div class="post-metadata">

**Author:** ![kukaoo](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/kukaoo/32/10333_2.png) [@kukaoo](https://www.thethingsnetwork.org/forum/u/kukaoo)\
**Post date:** [February 1, 2018, 6:53pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/9 "2018-02-01T18:53:43Z")

</div>

I just tested the curl with -i as advised and I got :

```nohighlight
HTTP/1.1 404 Not Found
Server: nginx/1.13.7
Date: Thu, 01 Feb 2018 18:48:04 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive

```

here is my curl command (I just modified my ttn account key)

`curl -i -X POST --data '{"dev_id":"kukaoo-001","port":1,"confirmed":false,"payload_raw":"T0ZG"}' https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/my-app-id/my-process-id?key=ttn-account-v2.xxxxxxxxxxxxxxxxxxxxxxx`

Help is much appreciated

---

<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:** [February 1, 2018, 7:07pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/10 "2018-02-01T19:07:06Z")

</div>

> [@kukaoo](#):
>
> /my-app-id/my-process-id

I assume you replaced those too?

(I am not using the integration, so have not checked right now if an URL like this would work for me. I’d assume that an unknown `my-app-id` or `my-process-id` might yield a 404 Not Found as well.)

---

<div class="post-metadata">

**Author:** ![kukaoo](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/kukaoo/32/10333_2.png) [@kukaoo](https://www.thethingsnetwork.org/forum/u/kukaoo)\
**Post date:** [February 1, 2018, 10:53pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/11 "2018-02-01T22:53:34Z")

</div>

Hi Arjan, thanks for your reply. Sorry my mistake  
I changed my-app-id and my-process\_id to the right values and my error is now  
there is something wrong I can’t see

HTTP/1.1 400 Bad Request  
Server: nginx/1.13.7  
Date: Thu, 01 Feb 2018 22:48:39 GMT  
Content-Type: text/plain; charset=utf-8  
Content-Length: 0  
Connection: keep-alive

---

<div class="post-metadata">

**Author:** ![kukaoo](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/kukaoo/32/10333_2.png) [@kukaoo](https://www.thethingsnetwork.org/forum/u/kukaoo)\
**Post date:** [February 5, 2018, 9:47pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/12 "2018-02-05T21:47:41Z")

</div>

Hi Arjan,

Any chance you have an idea on my issue?

device : kukaoo  
application : loratrack  
http integration: wialongw

`C:\Users\xxxx>curl -i -X POST --data '{"dev_id":"kukaoo","payload_raw":"AQE="}' https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/loratrack/wialongw?key=ttn-account-v2.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

HTTP/1.1 400 Bad Request  
Server: nginx/1.13.7  
Date: Mon, 05 Feb 2018 21:42:55 GMT  
Content-Type: text/plain; charset=utf-8  
Content-Length: 0  
Connection: keep-alive

---

<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:** [February 9, 2018, 8:13am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/13 "2018-02-09T08:13:57Z")

</div>

> [@kukaoo](#):
>
> C:\Users\xxxx\>curl

When using curl on Windows, you might want to have a look at [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).

---

<div class="post-metadata">

**Author:** ![kukaoo](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/kukaoo/32/10333_2.png) [@kukaoo](https://www.thethingsnetwork.org/forum/u/kukaoo)\
**Post date:** [February 11, 2018, 12:40pm UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/14 "2018-02-11T12:40:18Z")

</div>

Thanks Arjan  
problem solved.  
Regards

JP

---

<div class="post-metadata">

**Author:** ![blue2monster](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/blue2monster/32/45731_2.png) [@blue2monster](https://www.thethingsnetwork.org/forum/u/blue2monster)\
**Post date:** [March 29, 2020, 9:34am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/15 "2020-03-29T09:34:57Z")

</div>

Hi, Arjan, Thanks for your hints and the advise regarding CURL on windows.

I am still running into similar problems when trying out Downlink:

`curl -v -X POST --data "{\"dev_id\":\"XXXXREPLACED\",\"payload_raw\":\"AQE=\"}" https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/lXXXXREPLACED/XXXREPLACED?key=ttn-account-v2.SECRETKEY `

I always get a HTTP Error Code 401 unauthorized as a response:

```nohighlight
   Trying 13.69.184.129...
 TCP_NODELAY set
 Connected to integrations.thethingsnetwork.org (13.69.184.129) port 443 (#0)
 schannel: SSL/TLS connection with integrations.thethingsnetwork.org port 443 (step 1/3)
 schannel: checking server certificate revocation
 schannel: sending initial handshake data: sending 198 bytes...
 schannel: sent initial handshake data: sent 198 bytes
 schannel: SSL/TLS connection with integrations.thethingsnetwork.org port 443 (step 2/3)
 schannel: failed to receive handshake, need more data
 schannel: SSL/TLS connection with integrations.thethingsnetwork.org port 443 (step 2/3)
 schannel: encrypted data got 3013
 schannel: encrypted data buffer: offset 3013 length 4096
 schannel: sending next handshake data: sending 126 bytes...
 schannel: SSL/TLS connection with integrations.thethingsnetwork.org port 443 (step 2/3)
 schannel: encrypted data got 274
 schannel: encrypted data buffer: offset 274 length 4096
 schannel: SSL/TLS handshake complete
 schannel: SSL/TLS connection with integrations.thethingsnetwork.org port 443 (step 3/3)
 schannel: stored credential handle in session cache
 POST /ttn-eu/api/v2/down/secretID/SecretID?key=ttn-account-v2.hereIsMySecretkey HTTP/1.1
 Host: integrations.thethingsnetwork.org
 User-Agent: curl/7.55.1
 Accept: */*
 Content-Length: 41
 Content-Type: application/x-www-form-urlencoded

 upload completely sent off: 41 out of 41 bytes
 schannel: client wants to read 102400 bytes
 schannel: encdata_buffer resized 103424
 schannel: encrypted data buffer: offset 0 length 103424
 schannel: encrypted data got 201
 schannel: encrypted data buffer: offset 201 length 103424
 schannel: decrypted data length: 172
 schannel: decrypted data added: 172
 schannel: decrypted data cached: offset 172 length 102400
 schannel: encrypted data buffer: offset 0 length 103424
 schannel: decrypted data buffer: offset 172 length 102400
 schannel: schannel_recv cleanup
 schannel: decrypted data returned 172
 schannel: decrypted data buffer: offset 0 length 102400
 HTTP/1.1 401 Unauthorized
 Server: nginx/1.13.7
 Date: Sun, 29 Mar 2020 08:58:15 GMT
 Content-Type: text/plain; charset=utf-8
 Content-Length: 0
 Connection: keep-alive

 Connection #0 to host integrations.thethingsnetwork.org left intact 

```

Interesting: If I do the same thing on Google Script with my Request:

` UrlFetchApp.fetch("https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/XXX/XXX?key=ttn-account-v2.SECRETKEYREPLACED/", options);`

which looks like this:  
` UrlFetchApp.fetch([https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/XXX/XXXXr?key=ttn-account-v2.XXXREPLACED/, {method=POST, port=1.0, payload_raw=test, contentType=application/json, confirmed=false, dev_id=0123456}])`

I get as an Answer:  
` HTTP Error Code 401`

Anybody an Idea what I am doing wrong?  
Anybody an idea what i need to set in TTN Console settings?

---

<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:** [March 29, 2020, 9:50am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/16 "2020-03-29T09:50:23Z")

</div>

> [@blue2monster](#):
>
> HTTP Error Code 401 unauthorized

You’ll have to check id’s and secrets, both in the URL and in the JSON message.

> [@blue2monster](#):
>
> `method=POST, port=1.0, payload_raw=test, contentType=application/json, ...`

I’m not sure if the decimal point in 1.0 is accepted. But surely `"test"` is not a valid Base64 encoded string. Also, it seems all these are attributes of `options`? Indeed, `method` and `contentType` should be attributes of `options`, but whatever is to be actually POSTed should be in something like `options.body` instead, like `dev_id`, `payload_raw`, `port` and `confirmed`. You’ll have to show some code rather than only the logs.

Also, I noticed your edit. I doubt that the slash you added after `?key=ttn-account-v2.XXXREPLACED/` is really in the log…

---

<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:** [March 29, 2020, 10:05am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/17 "2020-03-29T10:05:33Z")

</div>

> [@blue2monster](#):
>
> `Content-Type: application/x-www-form-urlencoded`

Ah, you’re also not setting Content-Type in your curl command.

> [@arjanvanb](#):
>
> Indeed, `method` and `contentType` should be attributes of `options`

Maybe the Content-Type should even be in something like `options.headers`. You’ll need to check Google’s documentation.

---

<div class="post-metadata">

**Author:** ![blue2monster](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/blue2monster/32/45731_2.png) [@blue2monster](https://www.thethingsnetwork.org/forum/u/blue2monster)\
**Post date:** [March 29, 2020, 10:26am UTC](https://www.thethingsnetwork.org/forum/t/downlink-from-http-integration-does-not-show-in-ttn-console-and-does-not-reach-my-device/10330/18 "2020-03-29T10:26:23Z")

</div>

Hey Arjan,

thanks for that really fast answer. Your Content-Type hint finally solved my issue.  
To help others running into the same mistake: Here is my Source Code for Google Script

```auto
function myResponse() {

  var data = {
    "dev_id": "0123456",
    "port": 1,
    "confirmed": false,
    "payload_raw" : "1QIDBA=="
  };

  var options =
   {
     'method' : 'post',
     'contentType': 'application/json',
     'payload': JSON.stringify(data)
   };
  
  var response = UrlFetchApp.fetch("https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/XXXXREPLACEME/XXXXREPLACEME?key=ttn-account-v2.XXXXREPLACEME", options);  
  
  //var response = UrlFetchApp.fetch('http://www.google.com/');
  Logger.log(response.getContentText()); 
  var Test = "0"  
}

```

more Info can be found here: [DevDocumentationGoogle about Post in oogle Script](https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app)
