Latest Neocron News and Information

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

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

From Neocron Wiki
Jump to: navigation, search
Line 96: Line 96:
 
                     },
 
                     },
 
                     "status": "Imported",
 
                     "status": "Imported",
                     "image": null,
+
                     "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
 
                     "attribute": [ // Not all attributes will be available to API users
 
                         {
 
                         {
Line 129: Line 134:
 
             "url_json": "https://db.techhaven.org/item/1265.json"
 
             "url_json": "https://db.techhaven.org/item/1265.json"
 
         },
 
         },
       ... // Rest of response cut for clarity
+
       ... // Rest of JSON response cut for clarity
 
</pre>
 
</pre>
  

Revision as of 17:26, 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

Note on redirects