Jump to content

Return only specific objects from REST API response


notmacknelson

Recommended Posts

Hey guys,

I was wondering if there was a way to edit my curl GET request to the REST API to only target a specific piece of member data? For example, "https://bastionrp.com/api/core/members/26/?key={REDACTED}" returns this:

 "id": 26,
            "name": "Jimmy",
            "title": null,
            "timeZone": "America\/New_York",
            "formattedName": "<span class=\"Administrator Staff\"><i class=\"fa fa-shield\" aria-hidden=\"true\"><\/i> Jimmy<\/span>",
            "primaryGroup": {
                "id": 20,
                "name": "Administrator",
                "formattedName": "<span class=\"Administrator Staff\"><i class=\"fa fa-shield\" aria-hidden=\"true\"><\/i> Administrator<\/span>"
            },
            "secondaryGroups": [
                {
                    "id": 27,
                    "name": "Whitelisted",
                    "formattedName": "Whitelisted"
                },
                {
                    "id": 33,
                    "name": "Closed Testing Sessions",
                    "formattedName": "Closed Testing Sessions"
                }
            ],
            "email": "[REDACTED]",
            "joined": "2019-07-14T22:48:27Z",
            "registrationIpAddress": "[REDACTED]",
            "warningPoints": 0,
            "reputationPoints": 100,
            "photoUrl": "https:\/\/bastionrp.com\/uploads\/monthly_2019_10\/1966421603_JimmyVader.gif.c820d9ebd71d07be5bfb8dcccaceaa88.gif",
            "photoUrlIsDefault": false,
            "coverPhotoUrl": "",
            "profileUrl": "https:\/\/bastionrp.com\/profile\/26-jimmy\/",
            "validating": false,
            "posts": 182,
            "lastActivity": "2019-10-08T02:59:31Z",
            "lastVisit": "2019-10-07T21:14:43Z",
            "lastPost": "2019-10-08T01:12:54Z",
            "profileViews": 2165,
            "birthday": null,
            "customFields": {
                "1": {
                    "name": "Profile Settings",
                    "fields": {
                        "1": {
                            "name": "About Me",
                            "value": ""
                        },
                        "2": {
                            "name": "Custom Background Image",
                            "value": "monthly_2019_10\/source.gif.4984aa3cc6eff454abd38662533db700.gif"
                        },
                        "3": {
                            "name": "Custom YouTube Background",
                            "value": ""
                        },
                        "4": {
                            "name": "YouTube Background Sound Mute",
                            "value": "1"
                        },
                        "6": {
                            "name": "Custom Username Pulse Color",
                            "value": null
                        },
                        "7": {
                            "name": "Custom Username Pulse Color 2",
                            "value": null
                        },
                        "8": {
                            "name": "Custom Post Background Image",
                            "value": "monthly_2019_10\/paulo-silvano-fanart-star-wars-3.jpg.a4c00885569f7deb8fd660d15b46b15c.jpg"
                        },
                        "9": {
                            "name": "Custom Post Background Color",
                            "value": "#"
                        },
                        "10": {
                            "name": "Custom Post Outline",
                            "value": "#c20000"
                        },
                        "11": {
                            "name": "Custom Title",
                            "value": "The Anti-Hero"
                        },
                        "12": {
                            "name": "Custom Title Color",
                            "value": "#ffffff"
                        },
                        "13": {
                            "name": "Custom Profile Body Tint",
                            "value": "#"
                        },
                        "15": {
                            "name": "Custom Username Font",
                            "value": "Kalam"
                        },
                        "18": {
                            "name": "Unique Website Background",
                            "value": ""
                        }
                    }

We are looking for a way to drill down this data to send to a game server, and most of this isn't relative to that purpose. Is there a way to edit the get request URL to only return, for example, a response that looks like this?

"id": 26,
            "name": "Jimmy",
            "secondaryGroups": [
                {
                    "id": 27,
                    "name": "Whitelisted",
                    "formattedName": "Whitelisted"
                },
                {
                    "id": 33,
                    "name": "Closed Testing Sessions",
                    "formattedName": "Closed Testing Sessions"
                }
            ],
            "registrationIpAddress": "[REDACTED]"

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...