Skip to content

Sagleft/utopia-restful

Repository files navigation

utopia-restful

Utopia Network RESTful API written in PHP

Installation

composer update
mkdir data
touch data/crypton_rates.json
cd public_html
cp example.htaccess .htaccess
cd ../test/data
cp example.env .env
  • set utopia_token and utopia_http_port in .env;
  • Get the CoinLib api key on https://coinlib.io/
  • set coinlib_key in .env

Usage

example

curl http://rest/api/uns/sync_info

result:

{
	"last_record_names_registered": "upbit",
	"local_blocks": 194,
	"peers_connected": 21,
	"state": "Idle",
	"total_blocks": 194
}

help:

curl http://rest/api/help
{
	"version": "1.0.1",
	"date": "2019-12-26",
	"commands": 
	{
		"/api/sticker/collections": "returns collection names of stickers",
		"/api/sticker/names/<collection_name>": "returns available names from corresponded collection",
		"/api/sticker/image/<collection_name>/<sticker_name>": "returns image (base64 encoded) by sticker name from corresponded collection",
		"/api/channel/list": "returns the current list of all channels of Utopia ecosystem",
		"/api/channel/list/<filter>": "search by name of the channel (partial or complete matching)",
		"/api/channel/list/<filter>/<channel_type>": "search by channel_type: 0-All, 1-Recent, 2-My, 3-Friends, 4-Bookmarked, 5-Joined",
		"/api/channel/info/<channelid>": "returns the information about the channel",
		"/api/channel/moderators/<channelid>": "returns the list of public keys of moderators",
		"/api/channel/contacts/<channelid>": "returns the list of contacts on channel with details",
		"/api/channel/system_info/<channelid>": "returns system properties of channel",
		"/api/channel/send_message/<channelid>/<message>/<token>": "send a message to the channel by this id, indicating the api account token. will return request status",
		"/api/uns/search/<pubkey>": "returns the list of all uNS names registered for this public key",
		"/api/uns/search/<nick>": "returns the list of all uNS names registered for this nick",
		"/api/uns/sync_info": "returns statistics value of sync process",
		"/api/uns/whois/<pubkey>": "returns the detailed information about selected user by pubkey",
		"/api/uns/whois/<nick>": "returns the detailed information about selected user by nick",
		"/api/ucode/encode/<hex>": "returns image (base64 encoded) of ucode generated by hex string",
		"/api/ucode/decode/<image>": "returns hex public key from image in base64 format",
		"/api/rates": "returns Crypton exchange rate information to other currencies",
		"/api/rates/<to_currency>": "will return the Cypton rate to the currency under the code <to_currency>, e.g. BTC, RUB, USD, USDT, ETH, CNY, etc"
	}
}

image