Building APIs in Trongate v2
6 months ago
6 months ago
#1
I have been trying mu hands on Trongate v2 and I love it. I wanted to try to build some basic API endpoints with it and it has not been successful. I have tried searching through the docs but I can not find resources on how to build APIs.
6 months ago
#2
In Trongate v1, the API Explorer was an incredible built-in tool. I recall it being handled by an Api.php file within the engine folder.
I just checked and it looks like it's not there anymore in v2. It might have been stripped from the framework along with other modules that used to come pre-installed in Trongate v1.
Does that mean we have to implement this functionality manually or will there be an official API module based on the v1 API Explorer later on?
Any insight into the roadmap for API tools in v2 would be greatly appreciated!
I just checked and it looks like it's not there anymore in v2. It might have been stripped from the framework along with other modules that used to come pre-installed in Trongate v1.
Does that mean we have to implement this functionality manually or will there be an official API module based on the v1 API Explorer later on?
Any insight into the roadmap for API tools in v2 would be greatly appreciated!
6 months ago
#3
Im creating an API for my current main framework and am creating a subdomain endpoint to keep things separate (main system not in trongate), I really don't want to use lumen which i have used before, Is there any pointers I can get from past work, Im curretly doing stuff like this:-
The valdate_token method gets a valid trongate token from the header
any help is appreciated
Keith
The valdate_token method gets a valid trongate token from the header
any help is appreciated
Keith
6 months ago
#4
Hello Keith,
Your approach is spot on for handling manual endpoints in Trongate v2. Since the API Explorer was removed to keep the core lightweight, this "Controller-first" method is exactly how it should be done.
Before validating the token I would also make sure that the request type is correct:
Your approach is spot on for handling manual endpoints in Trongate v2. Since the API Explorer was removed to keep the core lightweight, this "Controller-first" method is exactly how it should be done.
Before validating the token I would also make sure that the request type is correct:
6 months ago
#5
I have built an api module. If you want it I can post it here for you to try.
Dan
Dan
6 months ago
#6
6 months ago
#7
Here's a video that popped up on my stream on the topic:
https://youtu.be/Z3uFzUCedpU?si=o5JNZ2KaPkTbfnQS
Dan, you should make a YT tutorial on it 👍
https://youtu.be/Z3uFzUCedpU?si=o5JNZ2KaPkTbfnQS
Dan, you should make a YT tutorial on it 👍