DestinyDevs / BungieNetPlatform

A community run wiki for the Bungie.net Platform APIs.
https://destinydevs.github.io/BungieNetPlatform/
MIT License
108 stars 12 forks source link

Destiny2 - GetProfile does not work (invalid parameter) #7

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi,

I did a GET for 'SearchDestinyPlayer' with the following result (which looks totally fine):

GET https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayer/2/mazor85/

{
    "Response": [
        {
            "iconPath": "/img/theme/destiny/icons/icon_psn.png",
            "membershipType": 2,
            "membershipId": "4611686018429193248",
            "displayName": "mazor85"
        }
    ],
    "ErrorCode": 1,
    "ThrottleSeconds": 0,
    "ErrorStatus": "Success",
    "Message": "Ok",
    "MessageData": {}
}

Doing the following request for GetProfile results to this:

GET https://bungie.net/Platform/Destiny2/2/Profile/4611686018429193248/

{
    "ErrorCode": 18,
    "ThrottleSeconds": 0,
    "ErrorStatus": "InvalidParameters",
    "Message": "The input parameters were invalid, please enter valid input, and try again.",
    "MessageData": {}
}

Any idea what I do wrong? I also have the API key in my header.

nine13tech commented 7 years ago

You are missing components in your request. From the Python output of the swagger v2 condegen: `def destiny2_get_profile(self, destiny_membership_id, membership_type, **kwargs):
"""
Returns Destiny Profile information for the supplied membership.
This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a 'callback' function to be invoked when receiving the response.

def callback_function(response):
pprint(response)

thread = api.destiny2_get_profile(destiny_membership_id, membership_type, callback=callback_function)
:param callback function: The callback function for asynchronous request. (optional)
:param int destiny_membership_id: Destiny membership ID. (required)
:param int membership_type: A valid non-BungieNet membership type. (required)
:param list[DestinyDestinyComponentType] components: A comma separated list of components to return (as strings or numeric values). See the DestinyComponentType enum for valid components to request. You must request at least one component to receive results.
:return: InlineResponse20014
If the method is called asynchronously, returns the request thread.`
You need to provide at least one of the following components:
https://bungie-net.github.io/multi/schema_Destiny-DestinyComponentType.html#schema_Destiny-DestinyComponentType

So append something like ?profiles=100 to the end of your request.

ghost commented 7 years ago

Thanks for the tip with the ComponentType @nine13tech!

The following request works:

GET https://bungie.net/Platform/Destiny2/2/Profile/4611686018429193248?components=100