0

{"error":{"code":"UnsupportedApiVersion","message":"The HTTP resource that matches the request URI

client.DefaultRequestHeaders.Add("version", "2")

What do I pass to the client to enable versioning?

Ian Jowett
  • 189
  • 18

1 Answers1

0

Use the header X-Version to specify the version(s), you can specify more than one version:

 Public Sub New(ByVal url As String)
        Dim handler As New HttpClientHandler()
        Dim uri As New Uri(url)

        handler.UseDefaultCredentials = True
        client = New HttpClient(handler)
        client.BaseAddress = New Uri(url)
        client.DefaultRequestHeaders.Accept.Clear()
        client.DefaultRequestHeaders.Accept.Add(New MediaTypeWithQualityHeaderValue("application/json"))
        client.Timeout = TimeSpan.FromSeconds(60)
        client.DefaultRequestHeaders.Add("X-Version", "1")
        client.DefaultRequestHeaders.Add("X-Version", "2")

        ErrorResponse = Nothing
    End Sub

client is compatible with version 1 and 2

Ian Jowett
  • 189
  • 18