Posted 21 April 2015 - 03:23 PM
Hello computercrafters,
I am here to bring you the App Store API, a few of you have asked for it so here it is my friends, the app store (if you don't know already) is a fully functional app store that works inside the Computers in CC. You can upload, download, edit, update, delete, view, categorise, comment, make private or public, an app. The store is all created in PHP and the API and the Store program are both coded in Lua of course. I have had a few people PM me asking to make it an API as I would love to see others making clients for it!!! We have a website but it isn't finished yet, so not long though! The API includes a nice sha256 hashing algorithm that HAS to be used otherwise it will not be recognised!
Website App Store (Advertisement)
Download:
If you wish to download the source and add it manually please go to here:
Website
GitHub
Pastebin
or if you wish to always have the updated version and just download and install it in the program then use the following code snippet at the top of your program:
License:
Thanks
Documentation:
Most functions will use a true or errormessage return which means if it isn't true then it will return the error.
So if you have tried logging in and it errored the error may say could not verify credentials which just means you used the wrong username or password. If it worked then it wil return true so it is pretty simple.
There is an array return if you try user.list() this will get a list of users like:
And it uses multidimensional arrays like the following to display things like all apps, which is just a huge array and it will look like this:
Okay so now that is out of the way let us explain what is what as I do not use things like post[1].appname etc, as this was a little hard at the time of making this, I will add this do not worry but for now follow this:
When you get the apps list:
AppId -> Used for deleting apps and getting the comments for an app as well as posting a comment etc.
AppName -> of course the name of the app.
AppDesc -> The app's description, would recommend using a wordwrapper when displaying this on screen.
AppVers -> This is the correct format for versioning: 1.0.0 ®. the first 3 numbers are only allowed to be 1 digit and the last letter in brackets means: alpha,beta or release version.
AppCategory -> This should be one fo the following: Game, Command, Program, Utility, OS, API, Turtle, Pocket, You can use custom may not show in others store clients though!
AppUrl -> If you are downloading an app use this link, this is a permalink and contains the raw code for the program, just readAll() and then save it.
AppIndex -> This is a unique address, please note that this will never be the same for another app, so if searching you can use this, or if you want to download a specific file liek pastebin get <8 digit code> <file name>, the index code will always be 8 characters long!
AppStatus -> This is a huge part, users should be allowed to make an app public or private, meaning private apps won't be visible and won't be downloaded, the app will be hidden until made public. the two options are: "public" or "private"
Then for the comments it comes back like so:
Anyway if you like +1 me, if you want more features added then just PM me or submit it as an issue on the Github Issues section for the App Store.
Extra help needed then contact me: danny.smc95@gmail.com, PM me on here :P/>
Cheers,
Danny
I am here to bring you the App Store API, a few of you have asked for it so here it is my friends, the app store (if you don't know already) is a fully functional app store that works inside the Computers in CC. You can upload, download, edit, update, delete, view, categorise, comment, make private or public, an app. The store is all created in PHP and the API and the Store program are both coded in Lua of course. I have had a few people PM me asking to make it an API as I would love to see others making clients for it!!! We have a website but it isn't finished yet, so not long though! The API includes a nice sha256 hashing algorithm that HAS to be used otherwise it will not be recognised!
Website App Store (Advertisement)
Download:
Spoiler
There are 4 places to get the API, that is via my Website, GitHub, Pastebin or On-The-Fly Methods.If you wish to download the source and add it manually please go to here:
Website
GitHub
Pastebin
pastebin get tJizkVAc storeapi
or if you wish to always have the updated version and just download and install it in the program then use the following code snippet at the top of your program:
aa = aa or {}
a = "https://vault.dannysmc.com/lua/api/appstoreapi.lua"
a = a.readAll()
local env = {}
a = loadstring(a)
local env = getfenv()
setfenv(a,env)
local status, err = pcall(a, unpack(aa))
if (not status) and err then
printError("Error loading api")
return false
end
local returned = err
env = env
_G["storeapi"] = env
License:
Spoiler
If you are to use this in your program/client, please put a credits to me for hosting the app store, that is all I ask :D/> It doesn't have to be big just as long as I am in it, please use the following: DannySMc (dannysmc95)Thanks
Documentation:
Spoiler
Hi guys, the majority of the API is built to be simple as anything to use. This means that you should not really struggle so let's just run through the different type of returns.Most functions will use a true or errormessage return which means if it isn't true then it will return the error.
So if you have tried logging in and it errored the error may say could not verify credentials which just means you used the wrong username or password. If it worked then it wil return true so it is pretty simple.
There is an array return if you try user.list() this will get a list of users like:
{
"user1",
"user2",
"user3",
}
And it uses multidimensional arrays like the following to display things like all apps, which is just a huge array and it will look like this:
{
{
"array 1 1",
"array 1 2",
"array 1 3",
},
{
"array 2 1",
"array 2 2",
"array 2 3",
}
}
Okay so now that is out of the way let us explain what is what as I do not use things like post[1].appname etc, as this was a little hard at the time of making this, I will add this do not worry but for now follow this:
When you get the apps list:
{
{
"appid",
"appname",
"appdesc",
"appvers",
"appcategory",
"appurl",
"appcreator",
"appindex",
"appstatus",
}
}
AppId -> Used for deleting apps and getting the comments for an app as well as posting a comment etc.
AppName -> of course the name of the app.
AppDesc -> The app's description, would recommend using a wordwrapper when displaying this on screen.
AppVers -> This is the correct format for versioning: 1.0.0 ®. the first 3 numbers are only allowed to be 1 digit and the last letter in brackets means: alpha,beta or release version.
AppCategory -> This should be one fo the following: Game, Command, Program, Utility, OS, API, Turtle, Pocket, You can use custom may not show in others store clients though!
AppUrl -> If you are downloading an app use this link, this is a permalink and contains the raw code for the program, just readAll() and then save it.
AppIndex -> This is a unique address, please note that this will never be the same for another app, so if searching you can use this, or if you want to download a specific file liek pastebin get <8 digit code> <file name>, the index code will always be 8 characters long!
AppStatus -> This is a huge part, users should be allowed to make an app public or private, meaning private apps won't be visible and won't be downloaded, the app will be hidden until made public. the two options are: "public" or "private"
Then for the comments it comes back like so:
{
{
"commentid",
"username",
"comment",
"appid",
},
}
CommentID -> is just the id for the comment,
Username -> This is who posted the comment,
Comment -> What the comment says,
Appid -> this relates to the app, so get the app id then get the comments for that app :)/>/>/>/>/>
Anyway if you like +1 me, if you want more features added then just PM me or submit it as an issue on the Github Issues section for the App Store.
Extra help needed then contact me: danny.smc95@gmail.com, PM me on here :P/>
Cheers,
Danny
Edited on 21 April 2015 - 01:27 PM