Forum - Bad request: 400 Connection close

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #65080
    Mustafa Noor
    Participant

    Hello,

    We have written a simple server side proxy (a small console app) to post data to Users Sandbox environment, but it gives Bad request Error: 400, connection close.
    But we can successfully post data through some other Clients Fiddler or Chrome extension boomerang (SOAP & REST Client) with the same Key and to same Sandbox Environment without any problem.
    Please have a look at Error line and let us know what actually going wrong?

    static async Task MainAsync()
    {

    client.BaseAddress = new Uri(“https://api-eu.hosted.exlibrisgroup.com”);

    var content = new FormUrlEncodedContent(new[]
    {

    new KeyValuePair<string, string>(“first_name”, “TestFirstName”),
    new KeyValuePair<string, string>(“last_name”,”TestLastName”),
    new KeyValuePair<string, string>(“account_type”,”INTERNAL”)

    });

    var json = JsonConvert.SerializeObject(content);
    var data = new StringContent(json, Encoding.UTF8, “application/json”);
    Eror Line: var result = await client.PostAsync(“/almaws/v1/users?apikey=…”, data); // Error at this line

    if (result.IsSuccessStatusCode)
    {
    Console.WriteLine(“OK”);
    }
    string resultContent = await result.Content.ReadAsStringAsync();
    Console.WriteLine(resultContent);
    }

    Error Line details: Got this Error during debug:

    {StatusCode: 400, ReasonPhrase: ‘Bad Request’, Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
    {
    X-Exl-Api-Remaining: 29981
    Connection: close
    Date: Tue, 11 Feb 2020 10:19:48 GMT
    P3P: CP=”IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT”
    Server: CA-API-Gateway/9.0
    Content-Length: 1277
    Content-Type: application/octet-stream; charset=UTF-8
    }}

    • This topic was modified 2 weeks, 2 days ago by Ori Miller.
    #65081
    Mustafa Noor
    Participant

    Please ignore &#8221 token at the end of this line. it’s added automatically when i post the question.
    client.BaseAddress = new Uri(“https://api-eu.hosted.exlibrisgroup.com”);

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.