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
(Created page with "== List of groups of datasets you have access to == <pre> curl -i -H "X-THN-API-User: <Your API user Key>" -H "X-THN-API-Key: <Your API key secret>" -H "Accept: application/j...")
 
(Access list response)
Line 3: Line 3:
 
<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/api/access-list.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/api/access-list.json
 +
</pre>
 +
 +
=== Response ===
 +
<pre>
 +
{
 +
    "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.
 +
    ]
 +
}
 
</pre>
 
</pre>
  

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

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