[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.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top