Skip to content

JSON Object which will be sent to backend. #6

@baltej223

Description

@baltej223

The following is the structure of a JSON object that will be sent to the backend from the frontend.

1. On API endpoint which users will use to inform about their own entry in library.

  • Informing, that they themselves have entered in library.
{
"timestamp":"1745500289", // Unix epoch one
"ip_address":"172.16.98.131", // local IP address
"mac":"00:1A:31:2D:34:E5", // The local (randomised) mac address
}

2. On API endpoint which will handle the scan results from users.

 {
    "timestamp": "1745500289",
    "self": {
        "ip_address": "172.16.98.131", // the IP of the device which have performed the scan.
        "mac": "00:1A:31:2D:34:E5", // The mac of the device which have performed the scan.
    },
    "scan": {
        // Either direct raw scan results [the parsing will be done on backend]
        "data": "scan_result_string",

        // Either scan data parsed and converted into json [on app] like {more preferable}
        "data": [
            {
                "ip_address": "172.16.98.131", // individual devices like this
                "mac": "00:1A:31:2D:34:E5",
            },
            {
                "ip_address": "172.16.98.131",
                "mac": "00:1A:31:2D:34:E5",
            },
            ...
        ]
    }
}

3. For API endpoint which will be handling the users which are on their own network and not using out application

{
    "timstamp":"1145500289",
    "mac":"00-AA-BB-CC-DD", // for preventing spamming, a unique identifier is required. If security is not necessary then it can be omitted
    "location":{
        "lang":"24.2421E",
        "lat":"134.324N"
    }
}

4. The API endpoint which will handle the APs identified when scanning device in monitor mode

{
    "timestamp":"1145500289",
    "self": {
        "ip_address": "172.16.98.131", // the IP of the device which have performed the scan.
        "mac": "00:1A:31:2D:34:E5", // The mac of the device which have performed the scan.
    },
    "scan":[ // The identified devices
        {"ap":"eduroam"},
        {"ap":"Iphone"},
        ...
    ]
}

  • In second point example decision of which type of JSON object to use is left for frontend Devs for them to choose according to their convenience. But If parsing is possible on frontend, it would be more preferable to parse the scan result on app itself.

  • Keep in mind JSON can't have comments and are present here only for the sake of understanding.

  • If something feels to be missing, a comment related to it can be added here only

  • Any doubts can be posted here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions