Latest Neocron News and Information

  • New test server patch #539 has been released to Vedeena

Difference between revisions of "THNapi:Items DB - JSON Examples"

From Neocron Wiki
Jump to: navigation, search
Line 144: Line 144:
 
<pre>
 
<pre>
 
curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/json" -H "Content-Type: application/json" -L https://db.techhaven.org/item/mendicant-rifle.json
 
curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/json" -H "Content-Type: application/json" -L https://db.techhaven.org/item/mendicant-rifle.json
 +
</pre>
 +
 +
=== Response ===
 +
<pre>
 +
{
 +
    "groups": {
 +
        "63": {
 +
            "id": 63,
 +
            "groupPath": "weapons/rifles/lowtech",
 +
            "name": "Lowtech Rifle",
 +
            "shortName": "Lowtech Rifle",
 +
            "description": "A weapon requiring the Rifle Combat (R-C) Skill."
 +
        }
 +
    },
 +
    "item": {
 +
        "parentVersion": null,
 +
        "weight": "3.65",
 +
        "text": null,
 +
        "name": "Mendicant Rifle",
 +
        "shortName": null,
 +
        "level": 6,
 +
        "patch": 176,
 +
        "version": 1,
 +
        "added": {
 +
            "date": "2006-01-31 11:56:53.000000",
 +
            "timezone_type": 3,
 +
            "timezone": "UTC"
 +
        },
 +
        "updated": {
 +
            "date": "2006-01-31 11:56:53.000000",
 +
            "timezone_type": 3,
 +
            "timezone": "UTC"
 +
        },
 +
        "image": {
 +
            "x": 96,
 +
            "y": 64,
 +
            "cdn_url": "https://cdn.techhaven.org/xxxxxxxxxxxxxxxxxxxxxxx.png",
 +
            "filename": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.png"
 +
        },
 +
        "linkItem": [ // Not available to all API users
 +
            {
 +
                "id": 1256,
 +
                "name": "Tangent Weaponpart 3",
 +
                "linkType": "part",
 +
                "quantity": 1
 +
            },
 +
            {
 +
                "id": 1258,
 +
                "name": "Tangent Weaponpart 5",
 +
                "linkType": "part",
 +
                "quantity": 1
 +
            },
 +
            {
 +
                "id": 1019,
 +
                "name": "Tangent Weaponpart 2",
 +
                "linkType": "part",
 +
                "quantity": 1
 +
            },
 +
            {
 +
                "id": 396,
 +
                "name": "Metal Plate",
 +
                "linkType": "recycle",
 +
                "quantity": 3
 +
            },
 +
            {
 +
                "id": 418,
 +
                "name": "Wire Junk",
 +
                "linkType": "recycle",
 +
                "quantity": 3
 +
            },
 +
            {
 +
                "id": 395,
 +
                "name": "Metal Pipes",
 +
                "linkType": "recycle",
 +
                "quantity": 1
 +
            }
 +
        ],
 +
        "status": "Imported",
 +
        "attribute": [
 +
            {
 +
                "name": "Dexterity",
 +
                "shortName": "DEX",
 +
                "attributeGroup": "Main Skills",
 +
                "attributeType": "requirement",
 +
                "value": "6.00",
 +
                "formatValue": 6
 +
            },
 +
            {
 +
                "name": "Rifle combat",
 +
                "shortName": "R-C",
 +
                "attributeGroup": "Dexterity",
 +
                "attributeType": "requirement",
 +
                "value": "15.00",
 +
                "formatValue": 15
 +
            },
 +
            {
 +
                "name": "This item is researchable",
 +
                "shortName": "Researchable",
 +
                "attributeGroup": "Item information",
 +
                "attributeType": "tag",
 +
                "value": "1.00",
 +
                "formatValue": "Enabled"
 +
            },
 +
            {
 +
                "name": "Weapon Type",
 +
                "shortName": "Weapon Type",
 +
                "attributeGroup": "Weapon information",
 +
                "attributeType": "tag",
 +
                "value": "45.00",
 +
                "formatValue": "Assault Rifle"
 +
            }
 +
        ],
 +
        "groupReference": 63,
 +
        "id": 1562
 +
    }
 +
}
 
</pre>
 
</pre>
  
 
== Note on redirects ==
 
== Note on redirects ==

Revision as of 17:28, 11 May 2020

List of groups of datasets you have access to

curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/json" -H "Content-Type: application/json" -L https://db.techhaven.org/api/access-list.json

Response

{
    "deny": [], // For THN use only
    "granted": [
        {
            "name": "Rifles",
            "path": "weapons/rifles",
            "granted": true
        },
        {
            "name": "Helmets",
            "path": "armor/helmets",
            "granted": true
        },
        {
            "name": "Brain implants",
            "path": "implants/brain",
            "granted": true
        },
        ... // Rest of output skipped for clarity.
    ]
}

API Response for a group

curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/json" -H "Content-Type: application/json" -L https://db.techhaven.org/weapons/melee.json

Response

{
    "groups": {
        "65": {
            "id": 65,
            "groupPath": "weapons/melee/lowtech",
            "name": "Lowtech Melee Weapon",
            "shortName": "Lowtech Melee Weapon",
            "description": "A weapon requiring the Melee Combat (M-C) Skill."
        },
        "76": {
            "id": 76,
            "groupPath": "weapons/melee/hightech",
            "name": "Hightech Melee Weapon",
            "shortName": "Hightech Melee Weapon",
            "description": "A weapon requiring the Melee Combat (M-C) and Hightech Combat (T-C) Skills."
        }
    },
    "items": [
        {
            "id": 1265,
            "visible": true,
            "pendingUpdates": false,
            "slug": "stiletto",
            "name": "Stiletto",
            "shortName": null,
            "level": 2,
            "patch": 176,
            "version": 2,
            "added": {
                "date": "2006-10-28 12:00:00.000000",
                "timezone_type": 3,
                "timezone": "UTC"
            },
            "updated": {
                "date": "2007-04-09 12:34:56.000000",
                "timezone_type": 3,
                "timezone": "UTC"
            },
            "detail": {
                "2": {
                    "parentVersion": 1,
                    "weight": "0.35",
                    "text": null,
                    "name": "Stiletto",
                    "shortName": null,
                    "level": 2,
                    "patch": 176,
                    "version": 2,
                    "added": {
                        "date": "2007-04-09 12:34:56.000000",
                        "timezone_type": 3,
                        "timezone": "UTC"
                    },
                    "updated": {
                        "date": "2007-04-09 12:34:56.000000",
                        "timezone_type": 3,
                        "timezone": "UTC"
                    },
                    "status": "Imported",
                    "image": {
                        "x": 64,
                        "y": 32,
                        "cdn_url": "https://cdn.techhaven.org/xxxxxxxxxxxxxxxxxxxxx.png", // Only visible to API users with access
                        "filename": "xxxxxxxxxxxxxxxxxxxxx.png" // Only visible to API users with access
                    },
                    "attribute": [ // Not all attributes will be available to API users
                        {
                            "name": "Strength",
                            "shortName": "STR",
                            "attributeGroup": "Main Skills",
                            "attributeType": "requirement",
                            "value": "1.00",
                            "formatValue": 1
                        },
                        {
                            "name": "This item is researchable",
                            "shortName": "Researchable",
                            "attributeGroup": "Item information",
                            "attributeType": "tag",
                            "value": "1.00",
                            "formatValue": "Enabled"
                        },
                        {
                            "name": "This item can be purchased from a shop vendor",
                            "shortName": "Purchasable",
                            "attributeGroup": "Item procurement",
                            "attributeType": "tag",
                            "value": "1.00",
                            "formatValue": "Enabled"
                        }
                    ],
                    "groupReference": 65
                }
            },
            "url": "https://db.techhaven.org/item/stiletto",
            "url_json": "https://db.techhaven.org/item/1265.json"
        },
       ... // Rest of JSON response cut for clarity

API Response for an Item

curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/json" -H "Content-Type: application/json" -L https://db.techhaven.org/item/1562.json

..or you can use the item slug.

curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/json" -H "Content-Type: application/json" -L https://db.techhaven.org/item/mendicant-rifle.json

Response

{
    "groups": {
        "63": {
            "id": 63,
            "groupPath": "weapons/rifles/lowtech",
            "name": "Lowtech Rifle",
            "shortName": "Lowtech Rifle",
            "description": "A weapon requiring the Rifle Combat (R-C) Skill."
        }
    },
    "item": {
        "parentVersion": null,
        "weight": "3.65",
        "text": null,
        "name": "Mendicant Rifle",
        "shortName": null,
        "level": 6,
        "patch": 176,
        "version": 1,
        "added": {
            "date": "2006-01-31 11:56:53.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "updated": {
            "date": "2006-01-31 11:56:53.000000",
            "timezone_type": 3,
            "timezone": "UTC"
        },
        "image": {
            "x": 96,
            "y": 64,
            "cdn_url": "https://cdn.techhaven.org/xxxxxxxxxxxxxxxxxxxxxxx.png",
            "filename": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.png"
        },
        "linkItem": [ // Not available to all API users
            {
                "id": 1256,
                "name": "Tangent Weaponpart 3",
                "linkType": "part",
                "quantity": 1
            },
            {
                "id": 1258,
                "name": "Tangent Weaponpart 5",
                "linkType": "part",
                "quantity": 1
            },
            {
                "id": 1019,
                "name": "Tangent Weaponpart 2",
                "linkType": "part",
                "quantity": 1
            },
            {
                "id": 396,
                "name": "Metal Plate",
                "linkType": "recycle",
                "quantity": 3
            },
            {
                "id": 418,
                "name": "Wire Junk",
                "linkType": "recycle",
                "quantity": 3
            },
            {
                "id": 395,
                "name": "Metal Pipes",
                "linkType": "recycle",
                "quantity": 1
            }
        ],
        "status": "Imported",
        "attribute": [
            {
                "name": "Dexterity",
                "shortName": "DEX",
                "attributeGroup": "Main Skills",
                "attributeType": "requirement",
                "value": "6.00",
                "formatValue": 6
            },
            {
                "name": "Rifle combat",
                "shortName": "R-C",
                "attributeGroup": "Dexterity",
                "attributeType": "requirement",
                "value": "15.00",
                "formatValue": 15
            },
            {
                "name": "This item is researchable",
                "shortName": "Researchable",
                "attributeGroup": "Item information",
                "attributeType": "tag",
                "value": "1.00",
                "formatValue": "Enabled"
            },
            {
                "name": "Weapon Type",
                "shortName": "Weapon Type",
                "attributeGroup": "Weapon information",
                "attributeType": "tag",
                "value": "45.00",
                "formatValue": "Assault Rifle"
            }
        ],
        "groupReference": 63,
        "id": 1562
    }
}

Note on redirects