How can I test my application by means of seeing the data at my HTTP integration

Hi everyone,

How can I test my application by means of seeing the data at my HTTP integration?

I have a very simple HTTP integration setup but I struggle how to initiate a test (I don’t have a device registered for that app)

The only test I found is below but does not push data via my integration

image

The test you found is only to validate the JavaScript code of the application’s Decoder, and its results are only displayed, not handled in any way. Uplinks are sent through a device, not the application.

To test an uplink, add a (dummy) device to your application in TTN Console, and scroll down on its Device Overview page. You’ll see Simulate Uplink:

Simulate uplink

This simulated uplink will always have frame counter 0, but will be accepted no matter what: frame counter security violations are simply ignored. (In fact, at this point in the processing chain, no LoRaWAN frame counter checks are done at all; frame counter security is handled by the broker, which is not involved when injecting test application payloads.)

Below, the 07:42:35 and 07:42:48 uplinks on port 4 have been simulated for an existing device, but all others are true uplinks (and an OTAA Join) by the actual hardware:

Device data

I assume this also works for OTAA devices that have never even joined.

The simulated uplink is also run through the (optional) Decoder in the application’s Payload Formats, and forwarded through the MQTT API and the (optional) Integrations, including the HTTP Integration and the Data Storage Integration. The downlinks in the screenshot have been scheduled by a Pipedream workflow triggered by the HTTP Integration. For a simulated uplink such scheduled downlinks will be transmitted after a next real uplink.

Note that the details in the MQTT API and HTTP Integration are very limited, especially lacking metadata such as frequency, data rate and any details of the gateway(s). The HTTP Integration payload for a simulated uplink:

{
  "app_id": "arjanvanb-app-ttnode",
  "dev_id": "arjanvanb-ttnode-1",
  "hardware_serial": "0004A30B001C1D1E",
  "port": 4,
  "counter": 0,
  "payload_raw": "EqAAFAjE",
  "payload_fields": {
    "battery": 4768,
    "event": "button",
    "light": 20,
    "temperature": 22.44
  },
  "metadata": {
    "time": "2020-05-26T05:42:35.045417629Z"
  },
  "downlink_url": "https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/arjanvanb-app-ttnode/arjanvanb-http-ttnnode?key=ttn-account-v2.kFd<redacted>Vi_il4"
}

For reference, the HTTP Integration payload for a true uplink received by just a single gateway:

{
  "app_id": "arjanvanb-app-ttnode",
  "dev_id": "arjanvanb-ttnode-1",
  "hardware_serial": "0004A30B001C1D1E",
  "port": 3,
  "counter": 2,
  "payload_raw": "EqAAFAkJ",
  "payload_fields": {
    "battery": 4768,
    "event": "motion",
    "light": 20,
    "temperature": 23.13
  },
  "metadata": {
    "time": "2020-05-26T05:42:42.08149377Z",
    "frequency": 867.5,
    "modulation": "LORA",
    "data_rate": "SF7BW125",
    "coding_rate": "4/5",
    "gateways": [
      {
        "gtw_id": "arjanvanb-gw-1",
        "timestamp": 3548004372,
        "time": "2020-05-26T05:42:41Z",
        "channel": 0,
        "rssi": -54,
        "snr": 7.5,
        "rf_chain": 0
      }
    ]
  },
  "downlink_url": "https://integrations.thethingsnetwork.org/ttn-eu/api/v2/down/arjanvanb-app-ttnode/arjanvanb-http-ttnnode?key=ttn-account-v2.kFd<redacted>Vi_il4"
}
3 Likes

Thank you - that did it. Great advice. I was able to test my http integration perfectly.

1 Like

A post was split to a new topic: HTTP Integration pushes from European Azure server for application on ttn-handler-us-west?

Hello Arjan, is this facility (uplink simulation) also integrated in the new console? Where can I find it? Thanks…

Sure, it’s still in Devices, now in Messaging:

V3 Simulate Uplink

1 Like

Aha, I found it. Thanks and regards…

I thought to quickly adapt my backend application to the new JSON uplink messages format. Uch… Not really backwards compatible, so back to the beginning for all applications… Keeping people at work is also an art. :rage:

That is probably why TTN has been trying to get people to move since march of this year. A decent window of time to schedule the work in…

2 Likes

Not so bad for me, I have plenty of time (I’m retired). But for professionals…?

We did it 6 months back: