CallThings - a simple api tester for developers #146
sokken
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
CallThings
This app is a work in progress, but is already quite useful for checking the implementation of any API endpoint one might be working on. Or just to check that inputs have the expected result when building an app. It is not yet in master on git, but is patiently waiting in the 1.3.0 branch.
Lets go through the UI top to bottom:
Top right is a button for pulling ones own user info. There is some generally useful info in the result. But it also functions as a selftest to see that there isnt silly error blocking in workspace or FriendCore. Result is only output to browser dev console, we'll come back to that.
Top left is the first actual input. In Friend the api is split between things implemented in C, the system.library, and the rest is in the module system, written in PHP. The calls for each behave slightly differently, hence the choice. Also all calls to FriendCore go to system.library, while the calls to the php modules have other options available.
If this next, optional , part is skipped, the call made goes through workspace and gets an appropriate authentication token automatically added before its passed to FriendCore. However various API endpoints have different authentication requirements/options, so if one wants to test with a specific token, it can be done by adding it here. This will also make the app build the call from scratch before sending it directly to FC, bypassing the extra stuff added by workspace.
Exec path is the path to the endpoint within either system.library or the module system. For a simple module call this might be 'userinfoget' in this input. Most calls have a bit more to their path though, like the system.library call user/sessionlist, wich returns a list of your active sessions. Still quite managable 😸
The last input is for supplying extra arguments to the call, in the form of JSON. If you get a red frame around this textarea when trying to make a call, your JSON did not compute.
The large open area headed by 'result', is where output is printed. There are two areas, one for error output and one for responses, but thats more of a guideline 🤣 This part is something we'd look to remove from the UI and only dump to console. Turns out the console is pretty good at parsing various things and displaying them in a good way, might aswell take advantage of that.
What the future brings
Theres certainly room for improvement. A history of calls made, to easily test multiple ones and go back to previous ones would be a good start. Maybe even a full reference of available API endpoints.
The app is currently usable on friendsky.cloud for playing around, but as mentioned earlier, has not yet been added to master.
What would you like to see in this a tool?
Beta Was this translation helpful? Give feedback.
All reactions