# Build a REST API with ASP.NET Web API

**URL:** <https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019>\
**Category:** Developer Blog Comments\
**Created:** [March 13, 2019, 5:41pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019 "2019-03-13T17:41:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [March 13, 2019, 5:41pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/1 "2019-03-13T17:41:55Z")

</div>

[Build a REST API with ASP.NET Web API](https://developer.okta.com/blog/2019/03/13/build-rest-api-with-aspnet-web-api)

Learn how to build RESTful API service with [ASP.NET](http://ASP.NET) Web API.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 15, 2019, 5:17pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/2 "2019-04-15T17:17:26Z")

</div>

**Rafael**

Nice post, but the option ‘Service’ is not available

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 16, 2019, 1:43pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/3 "2019-04-16T13:43:14Z")

</div>

**Matt Raible**

That’s probably because you’re using an Okta org that doesn’t have some developer feature flags turned on. I’d recommend you create a new org by signing up at [https://developer.okta.com/…](https://developer.okta.com/signup/ "https://developer.okta.com/signup/"). You can also send an email to [developers@okta.com](mailto:developers@okta.com) and ask to turn the feature flags on for OIDC.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [April 16, 2019, 5:32pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/4 "2019-04-16T17:32:41Z")

</div>

**Rafael**

Thanks @mattraible

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [May 20, 2019, 5:30am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/5 "2019-05-20T05:30:02Z")

</div>

**Asad Ali**

Nice Post. Thanks

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [August 27, 2019, 9:48am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/6 "2019-08-27T09:48:30Z")

</div>

**Nancy**

After run it showing me parent directory if I click on controller/ListItemsController.cs not found error I am getting.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [September 6, 2019, 3:12pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/7 "2019-09-06T15:12:37Z")

</div>

**Matt Raible**

Hello Nancy,

Did you figure out the problem? If not, can you post your code to a public GitHub repo so we can take a look?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [September 10, 2019, 5:19am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/8 "2019-09-10T05:19:04Z")

</div>

**Nancy**

Same issue Please check [https://github.com/ernancyt…](https://github.com/ernancythakkar/WebAPI "https://github.com/ernancythakkar/WebAPI")

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 14, 2019, 4:32am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/9 "2019-10-14T04:32:42Z")

</div>

**Quang**

Thank you, but i have an error when i “Request Token”  
"error getting access token from client\_credentials flow"  
Pls help me, thanks!

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [January 15, 2020, 9:06pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/10 "2020-01-15T21:06:03Z")

</div>

**Dale Shadle**

Well layed out. Unfortunately for me it failed after adding the controller and running it. GIves me - No assembly found containing an OwinStartupAttribute.  
- No assembly found containing a Startup or [AssemblyName].Startup class. I do see the Owin reference out there

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [March 5, 2020, 7:30pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/11 "2020-03-05T19:30:59Z")

</div>

**Jeff Ziegler**

This doesn’t work for me in VS2017 using framework 4.7.2, I am getting a 403.14 on URL: [http://localhost:10373/api/listitems/](http://localhost:10373/api/listitems/).

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [March 24, 2020, 8:32am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/12 "2020-03-24T08:32:05Z")

</div>

**Dean**

Is your URL def http and not https?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [March 24, 2020, 8:33am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/13 "2020-03-24T08:33:51Z")

</div>

**Dean**

Did you name the project the same as him? If not, check the namespace of your startup class, it needs to match your project name.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 12, 2020, 8:57pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/14 "2020-06-12T20:57:29Z")

</div>

**dennis602**

How would you call just the WebApi with Okta using Postman? Would it be possible to have a stand alone WebApi Authentication/Authorization web api that any application can call and use?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [June 15, 2020, 5:23pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/15 "2020-06-15T17:23:25Z")

</div>

**Matt Raible**

We have [Postman Collections](https://developer.okta.com/docs/reference/postman-collections/ "https://developer.okta.com/docs/reference/postman-collections/") you can use to call our API directly.

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [August 25, 2020, 1:58pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/16 "2020-08-25T13:58:12Z")

</div>

**Eddy Troy**

question:  
how to add swagger document into this application

thanks,

Eddy

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 6, 2020, 2:43pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/17 "2020-10-06T14:43:39Z")

</div>

**Luis Schz**

Followed step by step, but keep getting “Authorization has been denied for this request.” There is only one difference I’ve found. On the instructions it says, “Now go to your ListsController.cs and add an [Authorize] attribute right above the class definition.” but nowhere in the tutorial they have us create a ListController.cs, we have created a ListItemsController and that’s where I added the [Authorize] attribute. Was I correct on adding it to the ListItemsController.cs or am I actually missing the ListController.cs? Any help is appreciated. Thanks!

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [October 13, 2020, 5:44pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/18 "2020-10-13T17:44:53Z")

</div>

**Suzanne Tighe**

I am having the exact same error - did you figure this out yet?

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [November 16, 2020, 5:40pm UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/19 "2020-11-16T17:40:40Z")

</div>

**Jake Hollcroft**

As soon as I added

`[Authorize] public class ListsController : ApiController {`

I get this error message:

{  
 “message”: “No HTTP resource was found that matches the request URI ‘[https://localhost:44347/api/listitems](https://localhost:44347/api/listitems)’.”,  
 “messageDetail”: “No type was found that matches the controller named ‘listitems’.”  
}

---

<div class="post-metadata">

**Author:** ![oktadev-blog](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/oktadev-blog/32/3422_2.png) [@oktadev-blog](https://devforum.okta.com/u/oktadev-blog)\
**Post date:** [December 22, 2020, 9:37am UTC](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019/20 "2020-12-22T09:37:25Z")

</div>

**chetan**

Thanks for nice article. However when I am trying to use the same its giving me an error “proxy authentication required” at below line of code.

var discoveryDocument = Task.Run(() =\> configurationManager.GetConfigurationAsync()).GetAwaiter().GetResult();

Can you please suggest how to inject proxy in this?

[Next page](https://devforum.okta.com/t/build-a-rest-api-with-asp-net-web-api/17019.md?page=2)
