Latest Neocron News and Information

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

THNapi:Items DB - JSON Examples

From Neocron Wiki
Jump to: navigation, search

List of groups of datasets you have access to

curl -i -H "X-THN-API-Key: <Your API key>" -H "X-THN-API-Secret: <Your API secret>" -H "Accept: application/json" -H "Content-Type: application/json" https://db.techhaven.org/nc-db/api/v3.0/group-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-Key: <Your API key>" -H "X-THN-API-Secret: <Your API secret>" -H "Accept: application/json" -H "Content-Type: application/json" https://db.techhaven.org/nc-db/api/v3.0/get-group.json?path=weapons/melee

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-Key: <Your API key>" -H "X-THN-API-Secret: <Your API secret>" -H "Accept: application/json" -H "Content-Type: application/json" https://db.techhaven.org/nc-db/api/v3.0/get.json?item=1562

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
    }
}

Items DB API Breaking changes 3.2

Version 3.2 introduces a new set of API endpoints for getting data from the Items DB, and drops getting data via the User UI by adding .json to the endpoint. This means you will have to update your application to use the new endpoints.