Legacy THNapi:Linking Commands Guide

From Neocron Wiki
Jump to: navigation, search

Linking Commands Guide

The Linking Commands Guide is a guide to using the THNapi:LinkStartBulkUpdate, THNapi:LinkUpdate and THNapi:LinkFinishBulkUpdate command within the THN API

Purpose

The linking commands allow website owners who are using the THN API to add links to the Items DB to your webpages when they use the Item DB tags.

So if you have a page taking about the Terminator Quad on your website, and you use a Item DB tag to link to the THN item DB, you will be able to send a notification to the THN API saying "This page has Item DB tags in it, please link me to me!"

Then the THN API would read your page, looking for Item DB tags. It would then pickup and Item DB tags, and build a list of items used on the page, and add links to each Item to your webpage. The result would be a very extensive list of links on each item. So some possible ways this could be used.

  • Items would link to Wiki articles that mention the item (For example Smuggler page listings)
  • Items could link to N-Skill setups where the Item is used
  • Items could link to pages with people selling the item

The linking commands work in 2 ways. Single updates and bulk updates.

Single updates

Single updates are used to tell the THN API that a page with items on it has been updated. This would be used in conjunction with a Wiki hook, or some code after a page is saved. This is what would happen.

  • The website using the THN API would call a function to send a notification to the THN API
  • The function sends a notification to the THN API with the URL of the web page that is changed
  • The THN API recieves the notification. It checks that the update has come from a valid THN API user
  • The THN API loads the page and finds all the Item DB tags used
  • All the Item DB tags are expanded into a full list of Item ID's
    • The Item DB add's any new links for each item
    • Any links to existing items are left alone
    • Any temoved links to items are removed

Bulk updates

Sometimes you want the Item DB to completely refresh the links. The API allows this with a few two extra commands.

Clearing out old links

There is no command to clear out old links. However, here is a method to clear out old links.

A note

Users of the API should not do the following.

Any API users not following the correct way of updated is likely to have their API key revoked.