Skip to main content

Breaking down a Sample Response

As you have hopefully seen on the previous Page, the Responses can be a bit long. On average, you can expect a specific Weapon Request to be about 650 - 700 Lines of Formatted Json (About 13.42 KB of Data)
When you have such a long Response it's best to have some Standards at which you can base your Programm on.

Components of a Response

Every Response will have at least a few Components that are always the same.
Let's look at an Example Response:

{
"statusName": "Ok",
"isError": false,
"statusCode": 200,
"msg": {
"Message": "Hello World!"
}
}

Notice some similarities to the Response on the previous page?
That's right: Every Response will at least have the following Properties:

  • "statusName" : string
  • "isError" : boolean
  • "statusCode" : number,
  • "msg" : object

These Properties will always stay the same, across all Endpoints.
If you are not sure, how to parse and use a JSON response like this, follow this Tutorial.

The Weapon Response

Let's look at the Weapon Request once more.

{
"statusName": "Ok",
"isError": false,
"statusCode": 200,
"msg": {
"hash": 235827225,
"collectibleHash": 1042746134,
"name": "Eyasluna",
"classType": 3,
"classTypeName": "Unknown",
"itemType": 3,
"itemTypeName": "Weapon",
"damageType": 151347233,
"damageTypeName": "Stasis",
"ammoType": 1,
"ammoTypeName": "Primary",
"equipmentSlot": 1498876634,
"equipmentSlotName": "Kinetic Weapons",
"breakerType": 0,
"breakerTypeName": "None",
"specialItemType": 0,
"specialItemTypeName": "null",
"powerCap": 999990,
"sourceString": "Source: 'Grasp of Avarice' Dungeon",
"collectibleIcon": "/common/destiny2_content/icons/6a71ffaef39e6bad084b933b3f034ce6.jpg",
"itemSubTypeName": "Hand Cannon",
"itemSubType": 9,
"tierType": "Legendary",
"isRandomlyRolled": 1,
"icon": "235827225/collectible/icon",
"perks": [
{
"hash": 1294026524,
"perkName": "Adaptive Frame",
"column": 1,
"description": "A well-rounded grip, reliable and sturdy.",
"perkExplanation": "501 - Not Implemented",
"statArea": []
}
],
"stats": [
{
"statName": "Stability",
"statValue": 64,
"statHash": 155624089,
"statExplanation": "501 - Not Implemented"
}
]
}
}

We, once again have the Required Components from the Components Section.
The StatusName is "Ok", indicating that the Server was able to fulfill the Request Successfully:

statusName: "Ok"
isErrorFalse: false

Both of these keys indicate that no Error has occurred and that you are good to go to process the Information on your End.

Using the "isError" Flag

The "isError" Flag is a boolean that turns true when either a Server or a Request Error.
It is a sort of "service" for you to conveniently check if an Error has occurred while your request was being processed.
You should check at the start of your Programm/Script if this Flag has Turned "true" and if it has handle this correctly.

In the Message Component is the actual Response to your Request. Notice how the statusName, statusCode and isError Keys are missing here, because they are not part of the core part of the Response:

{
"hash": 235827225,
"collectibleHash": 1042746134,
"name": "Eyasluna",
"classType": 3,
"classTypeName": "Unknown",
"itemType": 3,
"itemTypeName": "Weapon",
"damageType": 151347233,
"damageTypeName": "Stasis",
"ammoType": 1,
"ammoTypeName": "Primary",
"equipmentSlot": 1498876634,
"equipmentSlotName": "Kinetic Weapons",
"breakerType": 0,
"breakerTypeName": "None",
"specialItemType": 0,
"specialItemTypeName": "null",
"powerCap": 999990,
"sourceString": "Source: 'Grasp of Avarice' Dungeon",
"collectibleIcon": "/common/destiny2_content/icons/6a71ffaef39e6bad084b933b3f034ce6.jpg",
"itemSubTypeName": "Hand Cannon",
"itemSubType": 9,
"tierType": "Legendary",
"isRandomlyRolled": 1,
"icon": "235827225/collectible/icon",
"perks": [
{
"hash": 1294026524,
"perkName": "Adaptive Frame",
"column": 1,
"description": "A well-rounded grip, reliable and sturdy.",
"perkExplanation": "501 - Not Implemented",
"statArea": []
},
{
...
}
],
"stats": [
{
"statName": "Stability",
"statValue": 64,
"statHash": 155624089,
"statExplanation": "501 - Not Implemented"
},
{
...
}
]
}

Here you can find all the Information like the {"Name":"Eyasluna"} Key, as well as the TierType of the Weapon. You can also get the Icon of the Weapon:

Also, the Stats and Perks of the Weapons are included in their respective Arrays in the Object. alt-text

What to do next?

Congratulations! You completed this first Tutorial. You know have multiple options to continue: