Intro to Wapka API

Wapka API Documention
Post Reply
Administrator
Site Admin
Posts: 33
Joined: Tue Mar 07, 2023 7:56 am

Intro to Wapka API

Post by Administrator »

Wapka API is powerfull tools for developers. API will give you full control over wapka echosystem! We offer two kinds of APIs for developers.The Wapka Site API give you easy control over your wapka site. The Wapka Core API is used for official wapka site aka (wapka.org). You are welcome to use both APIs free of charge.
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)}}
Also You can directly use Wapka javascript library

Code: Select all

<script>
var APIKEY = WapkaSiteAPI.apikey;
</script>
All queries to the Wapka API must be served over HTTPS and need to be presented in this form:
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)
The response contains a JSON object, which always has a Boolean field ok and may have an optional String field description with a human-readable description of the result.
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"}
Valid Request will look like: (getMe)

Code: Select all

{
    "ok": true,
    "result": [
        {
            "id": 12345,
            "username": "Admin",
            "email": "[email protected]",
            "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
    }
}
All methods in the Wapka Site API are case-insensitive.
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": "[email protected]",
                "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": "[email protected]",
                "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": "[email protected]",
                "point": 1000
            }
        ]
    });
Quan.name.vn
Posts: 0
Joined: Wed May 24, 2023 3:33 am

Re: Intro to Wapka API

Post by Quan.name.vn »

wow that's amazing. wapka api is very useful. i just read this article about wapka api and found it great. if these are displayed in web.wapka.org in the "function tag" code guide, it's easy to see. I didn't even know wapka even had this wapka api. I just happened to surf the wapka forum and browse around to see this article about wapka api. To be honest, the wapka api shown here is difficult for others to know. I really hope the wapka api is still active so I can use it for my website. And I have a small suggestion: "Please display the wapka api in web.wapka.org in a place where wapka programmers can most easily see it so they can read and use it". thanks for everything !
shrmaprem0202
Posts: 38
Joined: Tue Mar 07, 2023 7:13 pm
Contact:

Re: Intro to Wapka API

Post by shrmaprem0202 »

Hello admin we need more examples of api like forum create and upload files please support 🙏
Post Reply