[Web] API, Restful API, Documentation and Best Usage (Thoughts)

rover2341

Is riding a roller coaster...Wee!
Reaction score
113
What Is API, And Restful API

When I say API, I mean You make a HTTP Request, and a server picks it up and does something. It may return data to you in general as string, json, or xml.

Restful API: Is close to the same thing, expect it pays attention to the "Method" or "Verb" Sent in the request. GET, POST, PUT, DELETE ...ect
The Main Benefit of Restful API Is that your apis have standardization on naming, and usage.

Problem

A Project I have more or less finished at work. Has a little over 100 API's.
And the requirements are tweaked often, so the apis need updated or additional ones are needed.
This is not Ideal.

Why So Many API's?

Lets Assume you have a table called Person with 50 Property's (and they stay the same, no additional)

Update Person API's:
There are several different apis that update person.
but some update a single field, where others update a few and some update several.

Get Person API's:
There are several Gets, some that get all (most) the fields, and others that give just some, or even one.
Now I could reduce this down to 1 or 2. And just give them all the data they are allowed. It wouldn't be the most efficient but it would reduce calls (Id like to avoid this)


Process:
  • New Requirement
  • Determine Additional/Change In API
  • (If I was not the person to do the last step) I am given API request.
  • I Create/Update API
  • Test API
  • Create Documentation
  • (If I was not the person to determine api request) Let Person know who needed It
  • They Use it, And If they have no problems we move forward. If not I go back and fix any issues related to the update/new api, and then we go back and forth in till we are done. Often during this process they realize they need additional data in the api.
Solution

For the Table "Person"

Proposed Process
  • New Requirement (That's it the first and last step)
Why is this better?
  • No Additional Or Change In API needs be considered
  • I am not given a API Request
  • I am not Creating Or Updating a API
  • I am not testing API a new or updated API
  • I am not creating additional documentation
  • I am not dealing with letting someone know I am done.
How can this be achieved?

On Update Person, You send in a list of key value pair, of the property and the value.
On Get Person, You send in a list of properties you would like.

Documentation would give you the list of all the properties.
And For things with "Rights" Requirements ect would be explained in the documentation.

Other Features
All Apis would have a optional Token Pram. This is for use of mobile applications, that do not have cookies, or its too much of a pain to get the cookie in the response and inject it into the next message.
With this, it would check there http request for cookie first, else check token.

This would make all the API's 100% Access to Phone Apps.

Also All of the apis would make a function call to Service, where all the logic would exist. This way for applications, that prefer use of Service Or if I want to turn on the service It can be done with extremely minimal effort.

Also Using Rest It will look in the http request to see if they are requesting it as json or xml.

By adding in the service layer, Its used as the business layer, (even if the service is never exposed) making it easier to test and maintain the code.

What Makes a Good API/Service
  • Documentation
  • Testing
  • Ease of use
  • Secure
  • Efficient
  • Work Everywhere
  • Maintainability

Concerns
  • Why isn't this a common method on medium to larger projects. (that use alot of ajax calls in the html, or in my case aspx)
  • Why haven't I heard of this
  • Why is this idea unwise?
Please tell me why this idea is unwise.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top