The Wapka Site API is an HTTP-based interface created for developers to manage there website it is replacement of traditional TAGING SYSTEM
To use this, you don't need to know anything about how Wapka TAGS and Functions works but you can still use both to make strongest bond and powerful functionality.
Authorization Process
Each visitor is given a unique authentication token and each token is valid for certain session.
The token looks something like 123456:kffb4pt8g3q11ic2edi674c9lr, but we'll use simply call it <apikey>.
To obtain tokens You have to use
Code: Select all
{{VAR(APIKEY)}}
Code: Select all
<script>
var APIKEY = WapkaSiteAPI.apikey;
</script>
Pass <apikey> as HTTP header or url parameter
https://api.wapka.org/METHOD_NAME.
Optionally you can bind <apikey> to url
https://api.wapka.org/<apikey>/METHOD_NAME
So API End Point is: https://api.wapka.org
To Make API Request You have to provide METHOD_NAME, APIKEY, METHOD_PARAMETER
Example: https://api.wapka.org/getMe?apikey=123456:kffb4pt8g3q11ic2edi674c9lr
Example: https://api.wapka.org/123456:kffb4pt8g3q11ic2edi674c9lr/getMe
We support GET and POST HTTP methods. We support four ways of passing parameters in Wapka Site API requests:
- URL query string
- application/x-www-form-urlencoded
- application/json (except for uploading files)
- multipart/form-data (use to upload files)
If ok equals True, the request was successful and the result of the query can be found in the result field and result inform will be on resultInfo fields.
In case of an unsuccessful request, ok equals false and the error is explained in the description
An Integer error_code field will be returned (also http response code will be set)
An error_type field will be return as well for method based custom error handling
An invalid request will be like:
Code: Select all
{"ok":false,"error_code":401,"error_type":"UNAUTHORIZED","description":"Provide valid API Token"}
Code: Select all
{
"ok": true,
"result": [
{
"id": 12345,
"username": "Admin",
"email": "example@wapka.org",
"type": 1,
"regdate": "2023-01-01 10:00:00",
"point": 1000,
"logindate": "2023-01-01 10:00:00",
"ip": "192.168.0.1",
"useragent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36",
"is_online": true,
"role": 10,
"avatar": "https://img.wapka.org/008er1.png",
"var": [
"first_name": "Wapka",
"last_name": "Web"
]
}
],
"resultInfo": {
"count": 1,
"total": 1,
"pagenum": 1
}
}
Available methods:
GetMe, LogOut, UserCreator, UserInfo, UserLogin, UserOnline, UserEdit, MessageCreator, MessageInfo, MessageEdit, FolderCreator, FolderEdit, FolderInfo, FileCreator, FileInfo, FileEdit, ForumCreator, ForumEdit, ForumInfo, PostCreator, PostInfo, PostEdit, DataTableCreator, DataTableInfo, DataTableEdit, DataCreator, DataInfo, DataEdit, YoutubeAPI
Parameter:
Parameter is integral part of method. Based on parameter Method will process your request. Every method has different sets of parameters. Some Parameter support string/mix some support only array as value.
Parameters are Case Sensitive
- apikey: is common parameter required for every method.
- fields: parameter is very important. If you don't need all the data returned by method then set only required fields. It is recommended to request only necessary information. For example to get username,email,point,avatar,var(first_name) you have to set fields parameter https://api.wapka.org/<apikey>/getMe?fields=username,email,var(first_name),point this will give you similar result:
Code: Select all
{ "ok": true, "result": [ { "username": "Admin", "email": "example@wapka.org", "point": 1000, "var": [ "first_name": "Wapka" ] } ] }
- custom[<name>]: to customize result you can set this parameter. Here you can use use all TAG CODE to dynamically Modify default result. You can rename result keys add custom item and so on.
https://api.wapka.org/<apikey>/getMe?custom[username]={{UPPER(%username%)}}&custom[test]={{VALUE(%point%)@PLUS(10)}}
Code: Select all
{ "ok": true, "result": [ { "username": "ADMIN", "email": "example@wapka.org", "point": 1000, "var": [ "first_name": "Wapka" ], "test": 1010 } ] }
- callback: We also support JSONP Just give us valid function name we will wrap it up!
Code: Select all
<script src="https://api.wapka.org/getMe?apikey=<apikey>&fields=username,email,point&callback=myFunc"></script>
Code: Select all
myFunc({ "ok": true, "result": [ { "username": "ADMIN", "email": "example@wapka.org", "point": 1000 } ] });