Skip to content

Server API

Anh Nguyen edited this page Feb 10, 2020 · 2 revisions

API reference

Account & Authentication

JWT authentication

Endpoint

POST /api/auth

Response

{
    "jwt_token": "jwt string",
    "expire_in": 642342532345
}

Register an account

Endpoint

(JWT Authorized)

POST /api/accounts

Params

Name Type Description
enc_pub_key (required) string Bitmark account's encryption public key in hex format.

Example:

{
    "enc_pub_key": "32744938d01c48eba026cc13c6f320a8"
}

Response

{
    "result": {
        "account_number": "fq5dQwwm7Y5ckZwYgG7aK1exL3oS8w7BvqCNbV8Bzf8wzZc5qo",
        "metadata": {},
        "created_at": "2019-10-29T16:05:27.617069+07:00",
        "updated_at": "2019-10-29T16:14:09.762852+07:00"
    }
}

Current account information

Endpoint

(JWT Authorized)

GET /api/accounts/me

Response

{
    "result": {
        "account_number": "fq5dQwwm7Y5ckZwYgG7aK1exL3oS8w7BvqCNbV8Bzf8wzZc5qo",
        "metadata": {},
        "created_at": "2019-10-29T16:05:27.617069+07:00",
        "updated_at": "2019-10-29T16:14:09.762852+07:00"
    }
}

FB archives

Submit an FB archive

This will submit a download session for fb archive. Download will be executed immediately or in a short period depends on server status. Result will be notified via OneSignal notification.

Endpoint

(JWT Authorized)

POST /api/archives

Params

Name Type Description
headers (optional) string Simulate all existing headers from current session
raw_cookie (optional) string Simulate all existing cookies from current session
file_url (required) string File url to download

Example:

{
    "headers": {
        "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",
        "Referer": "https://m.facebook.com/dyi/?x=AdnFXqQNnRYgIln8&referrer=cc_settings&tab=all_archives",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
    },
    "file_url": "https://bigzipfiles.facebook.com/p/dl/download/file.php?r=100012706444503&t=100012706444503&j=11&i=817084935391714&f=817086042058270&ext=1574238815&hash=AaAvn-lUGvTSYnuX",
    "cookies": [
        {
            "expire": "2021-11-19T04:03:19.000Z",
            "domain": ".facebook.com",
            "secure": true,
            "value": "%7B%22100012706444503%22%3A%22Ig81wj4g%22%7D",
            "path": "/login/device-based/",
            "httponly": true,
            "name": "dbln"
        }
    ]
}

Response

In case of success: HTTP Status Accepted with payload:

{
    "result": "OK"
}

List all submitted FB archive

This will submit a download session for fb archive. Download will be executed immediately or in a short period depends on server status. Result will be notified via OneSignal notification.

Endpoint

(JWT Authorized)

GET /api/archives

Response

In case of success: HTTP Status Accepted with payload:

{
    "result": [
        {
            "id": 16,
            "starting_time": "1970-01-01T08:00:00+08:00",
            "ending_time": "1970-01-01T08:00:00+08:00",
            "status": "stored",
            "created_at": "2019-12-13T16:49:16.437108+07:00",
            "updated_at": "2019-12-13T16:51:31.078849+07:00"
        }
    ]
}

Posts & reactions stats

These API provide a statistic for how many posts and reactions a user have, along with the average stats from all users on the system.

Endpoint

(JWT Authorized)

GET /api/stats/posts
GET /api/stats/reactions

Response

In case of success: HTTP Status Accepted with payload:

{
    "result": {
        "link": {
            "sys_avg": 1938.4383561643835,
            "count": 4
        },
        "media": {
            "sys_avg": 3.958904109589041,
            "count": 2
        },
        "undefined": {
            "sys_avg": 0,
            "count": 0
        },
        "update": {
            "sys_avg": 17.986301369863014,
            "count": 0
        }
    }
}

Server assets

Contains all server static assets

FB automation script

Endpoint

GET /assets/fb_automation.json