Downlink scheduling using http post requests and python with flask or django

Hi Guys,

I would like to schedule downlinks using python and either django, flask or the requests (preferred way) module. I was able to setup an http webhook with an endpoint and read out sensor data from an endnode using python.

Now, I would like to advance one step and schedule downlinks. I followed the appropriate documentation here:
How to schedule downlinks

To perform the post request, I need to know the exact URL. An example is provided as follows:
/api/v3/as/applications/{application_id}/webhooks/{webhook_id}/devices/{device_id}/down/push

But what is the base URL? Is it eu1.cloud.thethings.network and what is meant by webhook_id? From What I could see you can only provide an external endpoint.

Can I provide the API key as follows?

import requests
access_token = #yourAccessTokenHere#

result = requests.post(url,
      headers={'Content-Type':'application/json',
               'Authorization': 'Bearer {}'.format(access_token)})

Thank you!

When thinking of downlinks and especially automating the process have in mind the TTN FUP … limit is 10 per day… and as Nick of these parts says whenever a downlink happens a puppy goes hungry. Downlinks render the gw deaf to uplinks…your convenience is a nightmare for all other community users in range of said gw!

@Jeff-UK don’t worry, using downlinks will be an exception and we also extend the coverage by bringing out gateways in the field.

I can now send downlinks but I don’t understand the payload format provided in the documentation: frm_payload":“vu8=”

I receive this downlink as follows:
image

Please note that I have also pumped this thread. to avoid double posting

From this and your other post I DO worry - cleary you do not understand the technology or the service you are using!

The cry of ‘but its my device’ or ‘but its my gw’ or ‘but I am only…’ or ‘I/we are adding…’ doesnt wash if you research the Forum posts for the last N years!

Both the GW’s and the airwaves along with the back end infrastructure as and when used for and connected to TTN are a shared resource and are there for all and offered under terms of service and a manifesto with associated FUP that makes this approach unacceptable. As a major contributor of community GW’s myself this is done without reservation or special privaleges! Deploying GW’s does not afford you extra rights or some ring fenced use of the network/infrastructure…and location - in the field or in you own office/lab/home per your other post does not influence that…

Alright alright, I see and will have a different perspective about using downlinks in future. I thought more like changing the sensor transmission time out in the field eventually 1, 2 or 3 times during its lifetime, which should be up to 10 years.

That is fine - it follows the FUP and good netizenship - its the assumption behind what you do and how you do it I’m calling out :wink: A short breach for accidental (*) or short test (say mapping a community as was mentioned in the Summer Academy this week) is tolerated but many are not mindful of impact so we call out agressively when there may look to be a problem. If 150k TTN users all spend 1 day abusing ‘because I’m just testing’ we woudl have a huge issue :slight_smile:

(*) classic one is not realising you have the ‘sense’/logic wrong when programming a new device for unconfirmed vs confirmed packets (was that AT command 1 for confirmed and 0 for unforirmed…or was it…) and suddenly bang! - Think we have all done it :man_shrugging: