GENERATE A GUID FOR AN API

#3 GENERATE A GUID FOR AN API

Here is a RFC4122 version 4 compliant solution. simple click on the button to generate a GUID and optional copy button. This can be used to authenticate users and as a session log. Each unique ID can be used in an API as an API key for your users.

Example use in a home made API as follows:
https://myapidomain.com/api/count.php?&API_KEY=6f6825a7-ee36-4a01-ba19-c98cbc41049c&JSESSION=c0b3c124-66ae-4873-abf9-36cde947d78f&USERNAME=testing

Result example if there is an error:

{"result":5,"message":"api key does not exist!"}

The id attribute in the HTML allows the JS to execute the logic of this example

I tested the application using XAMPP which is a great lightweight Apache distribution which lets us create a local web server effortlessly.

You can read up on GUID’s here.

Leave a Reply

Your email address will not be published. Required fields are marked *