API Swagger Versioning query

Hi all,

I’m having a go at building an Admin API client for TTN so that I can programmatically configure devices from an Azure function.

I’m having some problems which look like versioning issues…

I generated my C# client with NSwag based on the swagger from here. It caught my attention when I had a look at the code as there were a lot of “V3” prefixes.

I then added the code todo authorisation and built a quick n dirty command line application, these are the key bits

string baseUrl = “http://eu.thethings.network:8084”;

endDeviceRegistryClient.ListAsync(applicationId) this returns an array of V3EndDevice

The call works as I can see the TTN server returning 200 and in my HTTPProxy debugger the payload looks validish but in the words of sesame street “one of these things is not like the other”

{
“devices”: [
{
“app_id”: “rak811wisnodetest”,
“dev_id”: “rak811wisnode1”,
“lorawan_device”: {
“app_eui”: “7ABCDEFGHIJKLMNE”,
“dev_eui”: “60C5A8FFFE777C32”,
“app_id”: “rak811wisnodetest”,
“dev_id”: “rak811wisnode1”,
“dev_addr”: “2ABCDEF4”,
“nwk_s_key”: “AABCDEFGHIJKLMNOPQRSTUVWXYZABCD0”,
“app_s_key”: “8ABCDEFGHIJKLMNOPQRSTUVWXYZABCD8”,
“app_key”: “6ABCDEFGHIJKLMNOPQRSTUVWXYZABCD3”,
“uses32_bit_f_cnt”: true,
“activation_constraints”: “local”
},
“description”: “OTAA Test client”
},
{
“app_id”: “rak811wisnodetest”,
“dev_id”: “rak811wisnodetest”,
“lorawan_device”: {
“app_eui”: “7ABCDEFGHIJKLMNE”,
“dev_eui”: “0ABCDEFGHIJKLMNC”,
“app_id”: “rak811wisnodetest”,
“dev_id”: “rak811wisnodetest”,
“dev_addr”: “2ABCDEF9”,
“nwk_s_key”: “CABCDEFGHIJKLMNOPQRSTUVWXYZABCD7”,
“app_s_key”: “8ABCDEFGHIJKLMNOPQRSTUVWXYZABCD5”,
“app_key”: “6ABCDEFGHIJKLMNOPQRSTUVWXYZABCD3”,
“uses32_bit_f_cnt”: true,
“activation_constraints”: “local”
},
“description”: “ABP Test client”
},

]
}

The matching C# class with JSON decorations

/// <summary>Defines an End Device registration and its state on the network.
/// The persistence of the EndDevice is divided between the Network Server, Application Server and Join Server.
/// SDKs are responsible for combining (if desired) the three.</summary>
[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.23.0 (Newtonsoft.Json v12.0.0.0)")]
public partial class V3EndDevice 
{
    [Newtonsoft.Json.JsonProperty("ids", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
    public V3EndDeviceIdentifiers Ids { get; set; }

    [Newtonsoft.Json.JsonProperty("created_at", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
    public System.DateTimeOffset? Created_at { get; set; }

    [Newtonsoft.Json.JsonProperty("updated_at", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
    public System.DateTimeOffset? Updated_at { get; set; }

    /// <summary>Friendly name of the device. Stored in Entity Registry.</summary>
    [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
    public string Name { get; set; }

    /// <summary>Description of the device. Stored in Entity Registry.</summary>
    [Newtonsoft.Json.JsonProperty("description", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
    public string Description { get; set; }


}

So either I used the wrong swagger or the wrong endpoint?

Any hints greatly appreciated…

Thanks

T:@KiwiBryn
G: github.com/KiwiBryn
B: blog.devmobile.co.nz

TTN is not (yet) running V3, so here is no endpoint that supports V3.