mTxServ / hytale-api-sdk-js

Node.js SDK for Hytale API

Home Page:https://hytale-api.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hytale API - Node.js Javascript SDK

Hytale Api - Node.js client for Hytale Official API

Created by mTxServ and Hytale.game. With this SDK, you can consume the official Hytale API in Node.js (javascript).

Demo projects

This SDK is used in the Hytale Bot Discord project which is an example implementation of a bot which allow user to show latest 3 blogposts from official Hytale website. See example

Installation

For Node.js

npm

Then install it via:

npm install hytale-api-sdk --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var HytaleApi = require('hytale-api-sdk');
 
var api = new HytaleApi.ArticlesApi();
 
var slug = "creating-creature-sounds-for-hytale"; // {String} Slug of article
 
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully');
    console.log(data);
  }
};
 
api.getArticleBySlug(slug, callback);

Documentation for API Endpoints

All URIs are relative to https://hytale.com/api

Class Method HTTP request Description
HytaleApi.ArticlesApi getArticleBySlug GET /blog/post/slug/{slug}
HytaleApi.ArticlesApi getArticles GET /blog/post/published
HytaleApi.ArticlesApi getArticlesOfMonthAndYear GET /blog/post/archive/{year}/{month}/
HytaleApi.JobsApi getJobs GET /job/listing

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

About

Node.js SDK for Hytale API

https://hytale-api.com/


Languages

Language:JavaScript 100.0%