We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

API returning 405 error

I am getting 405 error when trying to call my api.

Angular code:

new DataManager({ url: url, adaptor: new UrlAdaptor, crossDomain: true })
.executeQuery(new Query())
.then((e: any) => {
debugger;
state.dataSource(e.result);
});

API Code

[HttpGet]

[Route("GetAllTransactionData")]


public async Task GetAllTransactionData(int clientId)

{

try

{

string userName = this.User.GetEmail();

return Ok(await _transactionService.GetAllTransactionData(clientId));


}

catch (Exception ex)

{

string correlationId = await _exceptionLogHelper.LogException(ex, "TransactionData", "GetAllTransactionData");

return BadRequest(ex.Message);

}

}



The error i am getting is :





Please note: When trying to call the API without the datamanager its working fine the api is returning the value


1 Reply

JC Joseph Christ Nithin Issack Syncfusion Team October 27, 2022 12:29 PM

Hi Harshita,


  Greetings from Syncfusion support.


 Based on your query, you are facing a 405 issue when you are trying to return the data from the api using the datamanager. We suggest you to use the Web API adaptor  of the DataManager. Please refer the below documentation for more details.


Documentation: https://ej2.syncfusion.com/angular/documentation/data/adaptors/#web-api-adaptor


Please get back to us for further details.


Regards,

Joseph I.


Loader.
Live Chat Icon For mobile
Up arrow icon