# API advise

**URL:** <https://forum.radzen.com/t/api-advise/11399>\
**Category:** Blazor Server\
**Created:** [July 25, 2022, 10:21pm UTC](https://forum.radzen.com/t/api-advise/11399 "2022-07-25T22:21:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [July 25, 2022, 10:21pm UTC](https://forum.radzen.com/t/api-advise/11399/1 "2022-07-25T22:21:34Z")

</div>

Folks

Slightly off topic but it’s a Radzen blazor app so here goes…..

I have a server side apo and I want to create a way that I can get excel to read the contents of a query.

I have been looking into rest apis and odata and I’m going round in circles.

I have two problems I can’t get basic authentication to work. I am testing it with postman and I can a response with authentication but no data. If I remove the authorise attribute from the controller it works but that’s not secure.

In neither instance can I get the data to show in excel. It just gives an error.

Does anyone have any code snippets or links to a working sample? Or any other advice as to how to achieve the end result, data to excel.

Many thanks

John

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [July 26, 2022, 6:32am UTC](https://forum.radzen.com/t/api-advise/11399/2 "2022-07-26T06:32:40Z")

</div>

Hi @johnmu,

Is this default (MS Identity) security? Adding [Authorize] attribute to the controller (or partial class) should be enough:

> [@Export API security](http://forum.radzen.com/t/export-api-security/11275):
>
> Hello, When a datasource is imported a new controller to export excel and csv is generated (if the option is selected). This controller is not securized by default. Is there a way to securice it using the radzen IDE? On the other way, this is very very dangerous. Thanks

---

<div class="post-metadata">

**Author:** ![johnmu](https://forum.radzen.com/letter_avatar_proxy/v4/letter/j/b9bd4f/32.png) [@johnmu](https://forum.radzen.com/u/johnmu)\
**Post date:** [July 26, 2022, 9:03am UTC](https://forum.radzen.com/t/api-advise/11399/3 "2022-07-26T09:03:00Z")

</div>

Vladimir,

yes its the out of the box Default Radzen security NOT AD or Windows. Having read up it appears that my problem is I'm not authenticating the incoming request.

I'm using basic authenitcation with https but no idea how to authenticate the API request.

thanks

John

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [July 26, 2022, 9:17am UTC](https://forum.radzen.com/t/api-advise/11399/4 "2022-07-26T09:17:58Z")

</div>

This post might help you:

> **[How to test ASP.NET Core Web API with cookie authentication using Postman?](https://community.postman.com/t/how-to-test-asp-net-core-web-api-with-cookie-authentication-using-postman/4809)**
>
> Hi All. I posted this on Stack Overflow as a Q&A post; however, I don’t think it’ll be around for much longer… So I’m posting it here. I’m working on a ASP.NET Core MVC Web Application (.NET Core 2.1) that implements Cookie Authentication. The...
