/1 being appended to api url

48 views
Skip to first unread message

Doug Murphy

unread,
Apr 19, 2022, 12:40:50 PM4/19/22
to RestSharp
I am using RestSharp to make a call to eBay to retireive a oauth user token. When I make the call using Postman it works. In VB.Net I re-created the call using the latest version of RestSharp. When I monitor the call from the VB app using Fiddler I see that the endpoint being used is "POST https://api.sandbox.ebay.com/identity/v1/oauth2/token/1". It should be "POST https://api.sandbox.ebay.com/identity/v1/oauth2/token". The vb call returns 404 Not Found. 

Any idea why the RestSharp call is appending "/1" to the url?

Alexey Zimarev

unread,
Apr 20, 2022, 2:03:14 AM4/20/22
to RestSharp
RestSharp doesn't add anything to the request URL unless you tell it to. As you haven't posted your code, it's impossible to say what's wrong.

Doug Murphy

unread,
Apr 20, 2022, 11:54:09 AM4/20/22
to RestSharp
I wouldn't think it would add anything to the target url. Probably something I am doing but I can't see it. Here is the code I am testing with. I pretty much took it from Postman with some updates to work with the new version of RestSharp. Any suggestions would be appreciated. The code (sCode) I pass into the routine comes from eBay after the user authorizes issuing a user token. This routine should return the user token and a refresh token.

Async Sub RSGetCode(sCode As String)
        Dim client As RestClient = New RestClient("https://api.sandbox.ebay.com/identity/v1/oauth2/token")
        Dim request As RestRequest = New RestRequest(Method.Post)
        sCode = WebUtility.UrlDecode(sCode)
        With request
            .AddHeader("Content-Type", "application/x-www-form-urlencoded")
            .AddHeader("Authorization", "Basic TXVycGh5c0MtNzYxNy00ZGRmLTk5N2ItOD..........................")
            .AddParameter("grant_type", "authorization_code")
            .AddParameter("code", sCode)
            .AddParameter("redirect_uri", "Murphys_Creativ-Mu...........")
            .AddParameter("Scope", "https://api.ebay.com/oauth/api_scope/sell.inventory")

        End With
        Dim responce = Await client.PostAsync(request)
        'Dim responce = Await client.ExecuteAsync(request)
        Dim sR As String = responce.Content

    End Sub

Alexey Zimarev

unread,
Jun 10, 2022, 6:55:40 AM6/10/22
to RestSharp
Try making a call to a requestbin. I have no idea, I am sure RestSharp doesn't manipulate the URI unless it's told to do so by using path parameters.
Reply all
Reply to author
Forward
0 new messages