kryptokrona
  • Welcome to the Kryptokrona Wiki
  • ❓About
    • About Kryptokrona
    • Background and History
    • Kryptokrona Community
    • Contributing
    • Contributors
    • Frequently Asked Questions
    • Getting Started
    • Supporting
    • Technical Data
    • Timeline
  • 😎Developer
    • 😎Kryptokrona
      • Compiling from Source
      • Forking Kryptokrona
      • Local Testnet
      • Developer Resources
      • Running a Node on a Pi
      • Subwallets
      • kryptokronad behind HAProxy
      • CI/CD
      • Versioning
      • Help and Support
      • Kryptokrona API Docs
        • Daemon JSON RPC API
        • kryptokrona-wallet-backend-js
        • kryptokrona-service
        • RPC Errors
        • Wallet RPC API
        • Daemon HTTP RPC API
    • 🐦Hugin API
      • Setup
      • API usage examples
      • Build Test and Deployment
      • Dashboard
      • Database
      • Help and Support
      • Onion Services
      • Technologies
      • Test Environment
      • Testing
      • Websockets
      • Sponsors
      • Contribute
    • 🧰Kryptokrona Kotlin SDK
      • Getting Started
      • How To Use Kryptokrona SDK
  • 🎓Guides
    • 👛Wallets
      • 📜Making a Paper Wallet
      • 👜Making a Kryptokrona Wallet
      • 🚑Recovering your Wallet
      • 💻Using Kryptokrona Desktop Wallet
      • 💻Using Kryptokrona Desktop Wallet *deprecated*
      • 🛰️Using Remote Nodes
      • 👾Command Line
        • Using xkrwallet
    • 🐦Hugin API
      • Deploy Your Own Hugin API
  • 🐦Hugin Messenger
    • 📱How to use Hugin Mobile
  • 🕸️Node
    • 😇Deploy a Public Node (manually)
    • 🚢Deploy node with Docker
    • 🦅Deploy a Hugin Full Node with Docker
    • 🍇Run a Node on a Raspberry Pi
    • ✏️How to configure the node?
    • 🥾Node bootstrap
  • ⛏️Mining
    • ⛏️Get started with mining
    • 😎Solo-mining Kryptokrona
    • 🍇Mining with a SBC
    • 🧑‍🎓🧑🎓 Mining Intro
    • 📒Notes
    • 🌊Mining Pools
    • 🚚Mining with XMRig
    • 🏊‍♂️🏊♂ Run a Mining Pool
    • 📱Mining on Android
    • Mining on macOS
    • 🍯Mining on HiveOS
Powered by GitBook
On this page
  • Examples
  • JavaScript
  • Python
  1. Developer
  2. Hugin API

API usage examples

All available API endpoints can be seen here on our Postman: https://www.postman.com/kryptokrona?tab=collections. We also make sure to save these endpoints in the http directory in the repository where you can run the api endpoints in for example WebStorm or other HTTP client.

Examples

Below are some code examples in JavaScript and Python how to use the Hugin Cache to get data. To just try out the API and check out what kind of data that we expect to get back we recommend you check out our Postman.

JavaScript

POSTS

Get all posts:

import axios from 'axios'

axios.get('http://localhost:3000/api/v1/posts')
  .then(response => {
    console.log(response)
  })
  .catch(err => {
    console.log('ERROR: Could not get all posts from Hugin Cache.')
  })

HASHTAGS

Get trending hashtags:

import axios from 'axios'

axios.get('http://localhost:3000/api/v1/hashtags/trending')
  .then(response => {
    console.log(response)
  })
  .catch(err => {
    console.log('ERROR: Could not get all trending hashtags from Hugin Cache.')
  })

Python

POSTS

Get all posts:

import requests
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects

API_URL = 'http://localhost:3000/api/v1/posts'

try:
    headers = {'Content-Type': 'application/json'}
    response = requests.get(API_URL, headers=headers)
    print(response.json())
except (ConnectionError, Timeout, TooManyRedirects):
    print('ERROR: Could not get all posts from Hugin Cache.')

HASHTAGS

Get trending hashtags:

import requests
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects

API_URL = 'http://localhost:3000/api/v1/hashtags/trending'

try:
    headers = {'Content-Type': 'application/json'}
    response = requests.get(API_URL, headers=headers)
    print(response.json())
except (ConnectionError, Timeout, TooManyRedirects):
    print('ERROR: Could not get all trending hashtags from Hugin Cache.')
PreviousSetupNextBuild Test and Deployment

Last updated 2 years ago

😎
🐦