Latest Neocron News and Information
- New test server patch #563 has been released to Vedeena
Legacy THNapi:Linking Commands Guide
Linking Commands Guide
The Linking Commands Guide is a guide to using the THNapi:Mark, THNapi:Notify and THNapi:Clear Stale 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
- Then in the Databae any previous entries to the web page are removed
- And finally a new set of DB entries for each item is generated with the link to the page
Bulk updates
Sometimes you want the Item DB to completely refresh the links. The API allows this with two extra commands.
- First you send a mark command - this marks all data for your site as 'old'
- Then you send a set of Notification updates out. This will be the same as doing a single update, except it clears the old flag for each upate
- Finally you send a cleaout command - any data still marked as old is removed.