1. Frank Zettanucci
  2. SnapDevelop
  3. Wednesday, 5 April 2023 18:06 PM UTC

So I have reviewed the Rest WebAPI example application from Appeon located at

https://docs.appeon.com/snapdevelop2019r3/Secure_a_Web_API_with_JWT_Token/index.html#test-the-web-api

I am using PB 2022 for this and trying to build a simple WebAPI to do some very basic stuff.

My knowledge of WebAPI and C# already quite limited... the examples seem to be too basic and i need more help to see what the code COULD look like.

Does NOT have to be perfect, im not protecting national secrets here, its a basic PB app needing some webapi back and forth....

Goals were:

1. Build a basic WebAPI that can do some datastore retrieves using HttpPost/Get - Seems to work (from example provided)

2. Create some additional methods that could be called , some as endpoints (yeah nothing on that)

3. Create some methods as internal utility methods that should not be seen by anyone, i guess we call those 'business logic functions' ...  These could be called by the public endpoints from #2. no?

4. Secure the WebAPI itself using JWT (hence why i picked the example, i assume example works?)

5. Needs to have some way to authenticate the users as they connect and use the endpoints to begin with...
Probably again more private methods that are like a basic user login/password authenticate them to a database table?
I guess maybe i'm confused with what is illustrated so far...

The example does seem to function at basic enough level but no example of where to place private functions so that private logic/business logic can be executed by the public functions without exposing those private methods as endpoints to the users of the webapi, again, yes i know my skill is a bit weak but was hoping for some more real world examples of something more 'illustrative' to help me out.

Can someone please point me in a better direction with a more robust working example(s) of some restapi developed preferably with SnapDevelop 2022 so that I can see how its supposed to be setup?

More examples of the best stuff we all waited so many years for would be greatly appreciated.

F.

 

Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 5 April 2023 18:39 PM UTC
  2. SnapDevelop
  3. # 1

Hi Frank,

SnapDevelop is only an IDE that lets you work with ASP.NET Core Web APIs on C#. You will get more help resources by looking exactly for that:
See: Creating a Web API manually, Using Dependency Injection (for adding business logic, for example), Integrating JWT Authentication.

Of course, this is not going to be very useful if you're unfamiliar with C#. But asking for a tutorial on how to do custom business logic or custom endpoints without a robust understanding of the underlying language and framework is quite the tall order, IMO.

In the end, SnapDevelop is just a C#/ASP.NET Core IDE with built-in features for PB Code/DW migration to C#, and some pretty cool scaffolding tools.
As such, if you're looking for more in-depth customization of the resulting Web API there's no other way but to also go more in depth into C# and ASP.NET Core themselves.

Regards,
Francisco

Comment
  1. Frank Zettanucci
  2. Wednesday, 5 April 2023 20:28 PM UTC
Thanks folks ill look into those links and see what I can learn...

Trying to teach this old dog new tricks is not fun sometimes....
  1. Helpful
  1. Chris Pollach @Appeon
  2. Wednesday, 5 April 2023 21:21 PM UTC
Frank ... we now use the term "mature" dog - LOL! ;-)
  1. Helpful
  1. carlos efrain
  2. Thursday, 6 April 2023 14:09 PM UTC
Tomalo por el lado Bueno Chris

  1. Helpful 1
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 5 April 2023 18:35 PM UTC
  2. SnapDevelop
  3. # 2

perhaps watch some JWT token processing videos to get an overview on how it works.  this is part of a series, and are .net 6 specific.

 

.NET 6 Web API ? Create JSON Web Tokens (JWT) - User Registration / Login / Authentication - YouTube

.NET 6 Web API ? Read JWT Authorization Claims of a User (from a JSON Web Token) - YouTube

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 5 April 2023 18:51 PM UTC
Adding to what Mike said, the focus of Appeon documentation is the specific object we have added on top of .NET framework, which is the .NET DataStore. So definitely for generally learning .NET, Web API development, etc. I would recommend looking at learning resources outside of Appeon.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.