Raw API Handler - Donator Only

Post Reply
Posts: 258
Joined: Sat Mar 26, 2016 3:35 am

Raw API Handler - Donator Only

Post by Pocketpac » Tue Apr 18, 2017 11:08 pm

If target is just raw text and not a JSON, will return the text, else follow the below:

The raw api parser is able to take any url that dumps raw JSON and parse it. It can handle both Objects and Arrays, below is an example:

https://beam.pro/api/v1/users/2108 dumps the following (An example, not the whole thing):

Code: Select all

"user": {
    "level": 91,
    "social": {
      "twitter": "https://twitter.com/mrpocketpac"
    "id": 2108,
    "username": "Pocketpac",
    "verified": true,
    "experience": 122180,
    "sparks": 10401,
    "avatarUrl": "https://uploads.beam.pro/avatar/2108.jpg",
    "bio": "",
    "primaryTeam": null,
    "createdAt": "2015-02-24T03:44:31.000Z",
    "updatedAt": "2017-02-17T22:35:55.000Z"
If you are not familiar with JSON, stop and read here: https://www.tutorialspoint.com/json/

Lets say you wanted to get the users sparks count, you would use the following variable format:

the (_api_ section tells the url to pull, then everything after the ")" is for drilling into JSON. Since the key "sparks" is nested under the key "user", you add "user;sparks" (noting that the keys are separated via a ";".
This works for arrays to, just use the numerical index of the array object you want.

Example: Lets say you are trying to get an object "FinalObj" nested in the first index in the Array that is itself nested behind the key "KeyObj" you would do the following:


That would drill into the API and get the FinalObj that is nest in the first Array index (which is always index 0) while the array itself is nested under "KeyObj" and return the value of FinalObj, then insert that value into the message and return it in the chat message.

NOTE: Other variables do work within the url. Let's say you wanted to get the sparks of someone in particular, you could do the following:

Please let me know if this is clear, or how I could clear it up for you. Please remember this is designed for people who understand JSON on at-least a basic level.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests