Nat  Grady

Nat Grady

1664310000

HighchartR: A Htmlwidget Wrapper Around Highcharts and Highstock APIs

HighchartR

This is an early development version of the highchartR library, which is a htmlwidget wrapper around Highcharts and Highstock javascript graphing libraries (http://www.highcharts.com/demo).

Installation

The package is currently not available at CRAN, so you need devtools package for the installation. You can install the package as follows:

devtools::install_github('jcizel/highchartR')

There are two functions in the package that do most of the work: highcharts, which acts as a wrapper around the Highcharts library (http://api.highcharts.com/highcharts), and highstocks wraps the Highstock library (http://api.highcharts.com/highstock).

Examples

To be expanded..

Highcharts

data = mtcars
x = 'wt'
y = 'mpg'
group = 'cyl'

highcharts(
    data = data,
    x = x,
    y = y,
    group = group,
    type = 'scatter'
)

Highstock

library(data.table)
library(pipeR)
library(rlist)
library(quantmod)
library(dplyr)

symbols <- c("MSFT","C","AAPL")

symbols %>>%
list.map(
    get(getSymbols(.))
) %>>%
list.map(
    . %>>%
    as.data.frame %>>%
    mutate(
        name = .name,
        date = rownames(.)
    ) %>>%
    select(
        name,
        date,
        price = contains("close")
    ) %>>%
    data.table  
) %>>%
rbindlist ->
    data

highstocks(
    data = data,
    x = 'date',
    y = 'price',
    group = 'name'
)

Download Details:

Author: jcizel
Source Code: https://github.com/jcizel/highchartR 

#r #wrapper #apis 

HighchartR: A Htmlwidget Wrapper Around Highcharts and Highstock APIs

6 Popular PHP Libraries for Accessing Third Party APIs

In today's post we will learn about 6 Popular PHP Libraries for accessing third party APIs.

What is Accessing Third Party APIs?

Third party APIs are APIs provided by third parties - generally companies such as Facebook, Twitter, or Google - to allow you to access their functionality via JavaScript and use it on your site. One of the most obvious examples is using mapping APIs to display custom maps on your pages.

Table of contents:

  • Amazon Web Service SDK - The official PHP AWS SDK library.
  • Github - A library to interface with the Github API.
  • Mailgun - The official Mailgun PHP API.
  • Square - The official Square PHP SDK for payments and other Square APIs.
  • Stripe - The official Stripe PHP library.
  • Twilio - The official Twilio PHP REST API.

1 - Amazon Web Service SDK:

The official PHP AWS SDK library.

The AWS SDK for PHP makes it easy for developers to access Amazon Web Services in their PHP code, and build robust applications and software using services like Amazon S3, Amazon DynamoDB, Amazon Glacier, etc. You can get started in minutes by installing the SDK through Composer or by downloading a single zip or phar file from our latest release.

Getting Started

  1. Sign up for AWS – Before you begin, you need to sign up for an AWS account and retrieve your AWS credentials.
  2. Minimum requirements – To run the SDK, your system will need to meet the minimum requirements, including having PHP >= 5.5. We highly recommend having it compiled with the cURL extension and cURL 7.16.2+ compiled with a TLS backend (e.g., NSS or OpenSSL).
  3. Install the SDK – Using Composer is the recommended way to install the AWS SDK for PHP. The SDK is available via Packagist under the aws/aws-sdk-php package. If Composer is installed globally on your system, you can run the following in the base directory of your project to add the SDK as a dependency:
composer require aws/aws-sdk-php
  1. Please see the Installation section of the User Guide for more detailed information about installing the SDK through Composer and other means.
  2. Using the SDK – The best way to become familiar with how to use the SDK is to read the User Guide. The Getting Started Guide will help you become familiar with the basic concepts.
  3. Beta: Removing unused services — To date, there are over 300 AWS services available for use with this SDK. You will likely not need them all. If you use Composer and would like to learn more about this feature, please read the linked documentation.

Quick Examples

Create an Amazon S3 client

<?php
// Require the Composer autoloader.
require 'vendor/autoload.php';

use Aws\S3\S3Client;

// Instantiate an Amazon S3 client.
$s3 = new S3Client([
    'version' => 'latest',
    'region'  => 'us-west-2'
]);

Upload a file to Amazon S3

<?php
// Upload a publicly accessible file. The file size and type are determined by the SDK.
try {
    $s3->putObject([
        'Bucket' => 'my-bucket',
        'Key'    => 'my-object',
        'Body'   => fopen('/path/to/file', 'r'),
        'ACL'    => 'public-read',
    ]);
} catch (Aws\S3\Exception\S3Exception $e) {
    echo "There was an error uploading the file.\n";
}

Features

View on Github

2 - Github:

A library to interface with the Github API.

Uses GitHub API v3 & supports GitHub API v4. The object API (v3) is very similar to the RESTful API.

Features

  • Light and fast thanks to lazy loading of API classes
  • Extensively tested and documented

Requirements

Quick install

Via Composer.

This command will get you up and running quickly with a Guzzle HTTP client.

composer require knplabs/github-api:^3.0 guzzlehttp/guzzle:^7.0.1 http-interop/http-factory-guzzle:^1.0

Advanced install

We are decoupled from any HTTP messaging client with help by HTTPlug.

Using a different http client

composer require knplabs/github-api:^3.0 symfony/http-client nyholm/psr7

To set up the Github client with this HTTP client

use Github\Client;
use Symfony\Component\HttpClient\HttplugClient;

$client = Client::createWithHttpClient(new HttplugClient());

Read more about using different clients in our docs.

Framework integrations

Laravel

To integrate this library in laravel Graham Campbell created graham-campbell/github. See the installation instructions to get started in laravel.

Basic usage of php-github-api client

<?php

// This file is generated by Composer
require_once __DIR__ . '/vendor/autoload.php';

$client = new \Github\Client();
$repositories = $client->api('user')->repositories('ornicar');

From $client object, you have access to all available GitHub api endpoints.

View on Github

3 - Mailgun:

The official Mailgun PHP API.

This is the Mailgun PHP SDK. This SDK contains methods for easily interacting with the Mailgun API. Below are examples to get you started.

Installation

To install the SDK, you will need to be using Composer in your project. If you aren't using Composer yet, it's really simple! Here's how to install composer:

curl -sS https://getcomposer.org/installer | php

The Mailgun API Client is not hard coupled to Guzzle, Buzz or any other library that sends HTTP messages. Instead, it uses the PSR-18 client abstraction. This will give you the flexibility to choose what PSR-7 implementation and HTTP client you want to use.

If you just want to get started quickly you should run the following command:

composer require mailgun/mailgun-php symfony/http-client nyholm/psr7

Usage

You should always use Composer autoloader in your application to automatically load your dependencies. All the examples below assume you've already included this in your file:

require 'vendor/autoload.php';
use Mailgun\Mailgun;

Here's how to send a message using the SDK:

// First, instantiate the SDK with your API credentials
$mg = Mailgun::create('key-example'); // For US servers
$mg = Mailgun::create('key-example', 'https://api.eu.mailgun.net'); // For EU servers

// Now, compose and send your message.
// $mg->messages()->send($domain, $params);
$mg->messages()->send('example.com', [
  'from'    => 'bob@example.com',
  'to'      => 'sally@example.com',
  'subject' => 'The PHP SDK is awesome!',
  'text'    => 'It is so simple to send a message.'
]);

Attention: $domain must match to the domain you have configured on app.mailgun.com.

Usage of new method for updating web scheme

# Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
use Mailgun\Mailgun;

# Instantiate the client.
$mgClient = Mailgun::create('KEY', 'FULL_DOMAIN_URL');
$domain = "DOMAIN";

# Issue the call to the client.
$result = $mgClient->domains()->updateWebScheme($domain, 'https');

print_r($result);

Custom http request to the API

<?php
# Include the Autoloader (see "Libraries" for install instructions)
require 'vendor/autoload.php';
use Mailgun\Mailgun;

# Instantiate the client.
$mgClient = Mailgun::create('KEY', 'ENDPOINT');
$domain = "DOMAIN";

$path = 'some path';
$params = [];

# Issue the call to the client.
$resultPost = $mgClient->httpClient()->httpPost($path, $params);

$resultGet = $mgClient->httpClient()->httpGet($path, $params);

$resultPut = $mgClient->httpClient()->httpPut($path, $params);

$resultDelete = $mgClient->httpClient()->httpDelete($path, $params);

View on Github

4 - Square:

The official Square PHP SDK for payments and other Square APIs.

The Square Connect PHP SDK is retired (EOL) as of 2020-06-10 and will no longer receive bug fixes or product updates. To continue receiving API and SDK improvements, please follow the instructions below to migrate to the new Square PHP SDK.

The old Connect SDK documentation is available under the /docs folder.

Migrate to the Square PHP SDK

Follow the instructions below to migrate your apps from the deprecated square/connect sdk to the new library.

You need to update your app to use the Square PHP SDK instead of the Connect PHP SDK The Square PHP SDK uses the square/square identifier.

On the command line, run:

$ php composer.phar require square/square

-or-

Update your composer.json:

"require": {
    ...
    "square/square": "^5.0.0",
    ...
}

Update your code

  1. Change all instances of use SquareConnect\... to use Square\....
  2. Replace SquareConnect models with the new Square equivalents
  3. Update client instantiation to follow the method outlined below.
  4. Update code for accessing response data to follow the method outlined below.
  5. Check $apiResponse->isSuccess() or $apiResponse->isError() to determine if the call was a success.

To simplify your code, we also recommend that you use method chaining to access APIs instead of explicitly instantiating multiple clients.

Client instantiation

Connect SDK

require 'vendor/autoload.php';

use SquareConnect\Configuration;
use SquareConnect\ApiClient;

$access_token = 'YOUR_ACCESS_TOKEN';
# setup authorization
$api_config = new Configuration();
$api_config->setHost("https://connect.squareup.com");
$api_config->setAccessToken($access_token);
$api_client = new ApiClient($api_config);

Square SDK

require 'vendor/autoload.php';

use Square\SquareClient;
use Square\Environment;

// Initialize the Square client.
$api_client = new SquareClient([
  'accessToken' => "YOUR_ACCESS_TOKEN",
  'environment' => Environment::SANDBOX
]); // In production, the environment arg is 'production'

View on Github

5 - Stripe:

The official Stripe PHP library.

The Stripe PHP library provides convenient access to the Stripe API from applications written in the PHP language. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses which makes it compatible with a wide range of versions of the Stripe API.

Requirements

PHP 5.6.0 and later.

Composer

You can install the bindings via Composer. Run the following command:

composer require stripe/stripe-php

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.

require_once('/path/to/stripe-php/init.php');

Dependencies

The bindings require the following extensions in order to work properly:

  • curl, although you can use your own non-cURL client if you prefer
  • json
  • mbstring (Multibyte String)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Getting Started

Simple usage looks like:

$stripe = new \Stripe\StripeClient('sk_test_BQokikJOvBiI2HlWgH4olfQ2');
$customer = $stripe->customers->create([
    'description' => 'example customer',
    'email' => 'email@example.com',
    'payment_method' => 'pm_card_visa',
]);
echo $customer;

Client/service patterns vs legacy patterns

You can continue to use the legacy integration patterns used prior to version 7.33.0. Review the migration guide for the backwards-compatible client/services pattern changes.

Custom Request Timeouts

Note We do not recommend decreasing the timeout for non-read-only calls (e.g. charge creation), since even if you locally timeout, the request on Stripe's side can still complete. If you are decreasing timeouts on these calls, make sure to use idempotency tokens to avoid executing the same transaction twice as a result of timeout retry logic.

To modify request timeouts (connect or total, in seconds) you'll need to tell the API client to use a CurlClient other than its default. You'll set the timeouts in that CurlClient.

// set up your tweaked Curl client
$curl = new \Stripe\HttpClient\CurlClient();
$curl->setTimeout(10); // default is \Stripe\HttpClient\CurlClient::DEFAULT_TIMEOUT
$curl->setConnectTimeout(5); // default is \Stripe\HttpClient\CurlClient::DEFAULT_CONNECT_TIMEOUT

echo $curl->getTimeout(); // 10
echo $curl->getConnectTimeout(); // 5

// tell Stripe to use the tweaked client
\Stripe\ApiRequestor::setHttpClient($curl);

// use the Stripe API client as you normally would

View on Github

6 - Twilio:

The official Twilio PHP REST API.

Versions

twilio-php uses a modified version of Semantic Versioning for all changes. See this document for details.

Installation

You can install twilio-php via composer or by downloading the source.

Via Composer:

twilio-php is available on Packagist as the twilio/sdk package:

composer require twilio/sdk

Quickstart

Send an SMS

// Send an SMS using Twilio's REST API and PHP
<?php
$sid = "ACXXXXXX"; // Your Account SID from www.twilio.com/console
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/console

$client = new Twilio\Rest\Client($sid, $token);
$message = $client->messages->create(
  '8881231234', // Text this number
  [
    'from' => '9991231234', // From a valid Twilio number
    'body' => 'Hello from Twilio!'
  ]
);

print $message->sid;

Make a Call

<?php
$sid = "ACXXXXXX"; // Your Account SID from www.twilio.com/console
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/console

$client = new Twilio\Rest\Client($sid, $token);

// Read TwiML at this URL when a call connects (hold music)
$call = $client->calls->create(
  '8881231234', // Call this number
  '9991231234', // From a valid Twilio number
  [
      'url' => 'https://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient'
  ]
);

Specify Region and/or Edge

To take advantage of Twilio's Global Infrastructure, specify the target Region and/or Edge for the client:

<?php
$sid = "ACXXXXXX"; // Your Account SID from www.twilio.com/console
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/console

$client = new Twilio\Rest\Client($sid, $token, null, 'au1');
$client->setEdge('sydney');

A Client constructor without these parameters will also look for TWILIO_REGION and TWILIO_EDGE variables inside the current environment.

This will result in the hostname transforming from api.twilio.com to api.sydney.au1.twilio.com.

Enable Debug Logging

There are two ways to enable debug logging in the default HTTP client. You can create an environment variable called TWILIO_LOG_LEVEL and set it to debug or you can set the log level to debug:

$sid = "ACXXXXXX"; // Your Account SID from www.twilio.com/console
$token = "YYYYYY"; // Your Auth Token from www.twilio.com/console

$client = new Twilio\Rest\Client($sid, $token);
$client->setLogLevel('debug');

View on Github

Thank you for following this article.

Related videos:

Working with 3rd party APIs in Laravel

#php #accessing #third #apis 

6 Popular PHP Libraries for Accessing Third Party APIs

7 Favorite PHP Libraries and Web tools for Developing APIs

In today's post we will learn about 7 Favorite PHP Libraries and Web tools for Developing APIs. 

What is Developing APIs?

API (Application Programming Interface software) is a set of instructions, standards or requirements that enables a software or app to employ features/services of another app, platform or device for better services. In short, it's something that lets apps communicate with each other.

Table of contents:

  • Laminas API Tool Skeleton - An API builder built with the Laminas Framework.
  • Drest - A library for exposing Doctrine entities as REST resource endpoints.
  • HAL - A Hypertext Application Language (HAL) builder library.
  • Hateoas - A HATEOAS REST web service library.
  • Negotiation - A content negotiation library.
  • Restler - A lightweight framework to expose PHP methods as RESTful web API.
  • Wsdl2phpgenerator - A tool to generate PHP classes from SOAP WSDL files.

1 - Laminas API Tool Skeleton:

An API builder built with the Laminas Framework.

Installation

Via release tarball

Grab the latest release via the Laminas API Tools website and/or the releases page; each release has distribution tarballs and zipballs available.

Untar it:

$ tar xzf api-tools-skeleton-{version}.tgz

(Where {version} is the version you downloaded.)

Or unzip, if you chose the zipball:

$ unzip api-tools-skeleton-{version}.zip

(Where {version} is the version you downloaded.)

Via Composer (create-project)

You can use the create-project command from Composer to create the project in one go (you need to install composer):

$ curl -s https://getcomposer.org/installer | php -- --filename=composer
$ composer create-project -sdev laminas-api-tools/api-tools-skeleton path/to/install

Via Git (clone)

First, clone the repository:

# git clone https://github.com/laminas-api-tools/api-tools-skeleton.git # optionally, specify the directory in which to clone
$ cd path/to/install

At this point, you need to use Composer to install dependencies. Assuming you already have Composer:

$ composer install

All methods

Once you have the basic installation, you need to put it in development mode:

$ cd path/to/install
$ composer development-enable

Now, fire it up! Do one of the following:

  • Create a vhost in your web server that points the DocumentRoot to the public/ directory of the project
  • Fire up the built-in web server in PHP(note: do not use this for production!)

In the latter case, do the following:

$ cd path/to/install
$ php -S 0.0.0.0:8080 -ddisplay_errors=0 -t public public/index.php
# OR use the composer alias:
$ composer serve

You can then visit the site at http://localhost:8080/ - which will bring up a welcome page and the ability to visit the dashboard in order to create and inspect your APIs.

NOTE ABOUT USING APACHE

Apache forbids the character sequences %2F and %5C in URI paths. However, the Laminas API Tools Admin API uses these characters for a number of service endpoints. As such, if you wish to use the Admin UI and/or Admin API with Apache, you will need to configure your Apache vhost/project to allow encoded slashes:

AllowEncodedSlashes On

This change will need to be made in your server's vhost file (it cannot be added to .htaccess).

View on Github

2 - Drest:

A library for exposing Doctrine entities as REST resource endpoints.

This library allows you to quickly annotate your doctrine entities into restful resources. It comes shipped with it's own internal router, and can be used standalone or alongside your existing framework stack. Routes are mapped to either a default or customised service action that takes care of handling requests.

Setting up endpoints is as easy as adding in a simple annotation to an entity

/* @Drest\Resource(
 *    routes={
 *        @Drest\Route(
 *            name="get_user",
 *            route_pattern="/user/:id",
 *            verbs={"GET"}
 * )})
 * @ORM\Table(name="user")
 * @ORM\Entity
 */
class User
{
   .......
}

// hitting [GET] http://myapplication.com/user/123 may return:

{
  "user": {
    "name": "lee",
    "email": "lee@somedomain.com"
    ... + other attributes set up to be exposed ...
  }
}

Features

Quickly annotate existing Doctrine entities to become a fully functional REST resource.

Utilises the internal router for matching resource route patterns.

Specify what data you want to expose from your entities (including relations), or let the client choose!

Generate data objects using exposable data for your API users to consume.

Comes shipped with both JSON and XML representations, or you can create your own.

Allows media type detection from your client requests, getting you one step close to RMM level 3.

Use it independently from your existing framework stack, or alongside it.

Allows extension points so you can configure requests to your specific needs.

View on Github

3 - HAL:

A Hypertext Application Language (HAL) builder library.

This is a library for creating documents in the application/hal+json and application/hal+xml hypermedia formats

It requires PHP 5.4 or later.

<?php
require_once 'vendor/autoload.php';

use Nocarrier\Hal;

$hal = new Hal('/orders');
$hal->addLink('next', '/orders?page=2');
$hal->addLink('search', '/orders?id={order_id}');

$resource = new Hal(
    '/orders/123',
    array(
        'total' => 30.00,
        'currency' => 'USD',
    )
);

$resource->addLink('customer', '/customer/bob', array('title' => 'Bob Jones <bob@jones.com>'));
$hal->addResource('order', $resource);
echo $hal->asJson();
echo $hal->asXml();

Installation

The preferred method of installation is via packagist as this provides the PSR-0 autoloader functionality. The following command will download and install the latest version of the Hal library into your project.

php composer.phar require nocarrier/hal

Usage

Creating Hal Resources

A Hal resource can be created with no values set:

$hal = new \Nocarrier\Hal();

with a URI for the resource:

$hal = new \Nocarrier\Hal('/orders');

and also with an array of data:

$hal = new \Nocarrier\Hal('/orders', ['customerId' => 'CUS1234']);

Hal resources can also be created from existing XML or JSON documents:

$hal = \Nocarrier\Hal::fromJson($jsonString);
$hal = \Nocarrier\Hal::fromXml($xmlString);
$hal = \Nocarrier\Hal::fromXml($simpleXMLElement);

The depth of embedded resources parsed with both these methods is controlled by a second argument, which defaults to 0:

$hal = \Nocarrier\Hal::fromJson($jsonString, 5);

Alternatively, clone the project and install into your project manually.

View on Github

4 - Hateoas:

A HATEOAS REST web service library. PHP library to support implementing representations for HATEOAS REST web services.

Installation

The recommended way to install Hateoas is through Composer. Require the willdurand/hateoas package by running the following command:

composer require willdurand/hateoas

This will resolve the latest stable version.

Otherwise, install the library and setup the autoloader yourself.

Working With Symfony

There is a bundle for that! Install the BazingaHateoasBundle, and enjoy!

Usage

Important:

For those who use the 1.0 version, you can jump to this documentation page.

For those who use the 2.0 version, you can jump to this documentation page.

The following documentation has been written for Hateoas 3.0 and above.

Introduction

Hateoas leverages the Serializer library to provide a nice way to build HATEOAS REST web services. HATEOAS stands for Hypermedia as the Engine of Application State, and adds hypermedia links to your representations (i.e. your API responses). HATEOAS is about the discoverability of actions on a resource.

For instance, let's say you have a User API which returns a representation of a single user as follow:

{
    "user": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe"
    }
}

In order to tell your API consumers how to retrieve the data for this specific user, you have to add your very first link to this representation, let's call it self as it is the URI for this particular user:

{
    "user": {
        "id": 123,
        "first_name": "John",
        "last_name": "Doe",
        "_links": {
            "self": { "href": "http://example.com/api/users/123" }
        }
    }
}

Let's dig into Hateoas now.

Configuring Links

In Hateoas terminology, links are seen as relations added to resources. It is worth mentioning that relations also refer to embedded resources too, but this topic will be covered in the Embedding Resources section.

A link is a relation which is identified by a name (e.g. self) and that has an href parameter:

use JMS\Serializer\Annotation as Serializer;
use Hateoas\Configuration\Annotation as Hateoas;

/**
 * @Serializer\XmlRoot("user")
 *
 * @Hateoas\Relation("self", href = "expr('/api/users/' ~ object.getId())")
 */
class User
{
    /** @Serializer\XmlAttribute */
    private $id;
    private $firstName;
    private $lastName;

    public function getId() {}
}

In the example above, we configure a self relation that is a link because of the href parameter. Its value, which may look weird at first glance, will be extensively covered in The Expression Language section. This special value is used to generate a URI.

In this section, annotations are used to configure Hateoas. XML and YAML formats are also supported. If you wish, you can use plain PHP too.

Important: you must configure both the Serializer and Hateoas the same way. E.g. if you use YAML for configuring Serializer, use YAML for configuring Hateoas.

The easiest way to try HATEOAS is with the HateoasBuilder. The builder has numerous methods to configure the Hateoas serializer, but we won't dig into them right now (see The HateoasBuilder). Everything works fine out of the box:

use Hateoas\HateoasBuilder;

$hateoas = HateoasBuilder::create()->build();

$user = new User(42, 'Adrien', 'Brault');
$json = $hateoas->serialize($user, 'json');
$xml  = $hateoas->serialize($user, 'xml');

The $hateoas object is an instance of JMS\Serializer\SerializerInterface, coming from the Serializer library. Hateoas does not come with its own serializer, it hooks into the JMS Serializer.

By default, Hateoas uses the Hypertext Application Language (HAL) for JSON serialization. This specifies the structure of the response (e.g. that "links" should live under a _links key):

{
    "id": 42,
    "first_name": "Adrien",
    "last_name": "Brault",
    "_links": {
        "self": {
            "href": "/api/users/42"
        }
    }
}

For XML, Atom Links are used by default:

<user id="42">
    <first_name><![CDATA[Adrien]]></first_name>
    <last_name><![CDATA[Brault]]></last_name>
    <link rel="self" href="/api/users/42"/>
</user>

It is worth mentioning that these formats are the default ones, not the only available ones. You can use different formats through different serializers, and even add your owns.

Now that you know how to add links, let's see how to add embedded resources.

View on Github

5 - Negotiation:

A content negotiation library.

Negotiation is a standalone library without any dependencies that allows you to implement content negotiation in your application, whatever framework you use. This library is based on RFC 7231. Negotiation is easy to use, and extensively unit tested!

Installation

The recommended way to install Negotiation is through Composer:

$ composer require willdurand/negotiation

Usage Examples

Media Type Negotiation

$negotiator = new \Negotiation\Negotiator();

$acceptHeader = 'text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8';
$priorities   = array('text/html; charset=UTF-8', 'application/json', 'application/xml;q=0.5');

$mediaType = $negotiator->getBest($acceptHeader, $priorities);

$value = $mediaType->getValue();
// $value == 'text/html; charset=UTF-8'

The Negotiator returns an instance of Accept, or null if negotiating the best media type has failed.

Language Negotiation

<?php

$negotiator = new \Negotiation\LanguageNegotiator();

$acceptLanguageHeader = 'en; q=0.1, fr; q=0.4, fu; q=0.9, de; q=0.2';
$priorities          = array('de', 'fu', 'en');

$bestLanguage = $negotiator->getBest($acceptLanguageHeader, $priorities);

$type = $bestLanguage->getType();
// $type == 'fu';

$quality = $bestLanguage->getQuality();
// $quality == 0.9

The LanguageNegotiator returns an instance of AcceptLanguage.

Encoding Negotiation

<?php

$negotiator = new \Negotiation\EncodingNegotiator();
$encoding   = $negotiator->getBest($acceptHeader, $priorities);

The EncodingNegotiator returns an instance of AcceptEncoding.

Charset Negotiation

<?php

$negotiator = new \Negotiation\CharsetNegotiator();

$acceptCharsetHeader = 'ISO-8859-1, UTF-8; q=0.9';
$priorities          = array('iso-8859-1;q=0.3', 'utf-8;q=0.9', 'utf-16;q=1.0');

$bestCharset = $negotiator->getBest($acceptCharsetHeader, $priorities);

$type = $bestCharset->getType();
// $type == 'utf-8';

$quality = $bestCharset->getQuality();
// $quality == 0.81

The CharsetNegotiator returns an instance of AcceptCharset.

Accept* Classes

Accept and Accept* classes share common methods such as:

  • getValue() returns the accept value (e.g. text/html; z=y; a=b; c=d)
  • getNormalizedValue() returns the value with parameters sorted (e.g. text/html; a=b; c=d; z=y)
  • getQuality() returns the quality if available (q parameter)
  • getType() returns the accept type (e.g. text/html)
  • getParameters() returns the set of parameters (excluding the q parameter if provided)
  • getParameter() allows to retrieve a given parameter by its name. Fallback to a $default (nullable) value otherwise.
  • hasParameter() indicates whether a parameter exists.

View on Github

6 - Restler:

A lightweight framework to expose PHP methods as RESTful web API.

Restler is a simple and effective multi-format Web API Server written in PHP.

Just deal with your business logic in php, restler will take care of the REST!

Features

  • No Learning Curve
  • Light weight
  • Flexible
  • Highly Customizable
  • Many Examples that can be tried on your localhost to get started
  • Supports HTTP request methods HEAD, GET, POST, PUT, DELETE, OPTIONS and PATCH via header or request parameter (method)
  • Supports both RESTful and Pragmatic REST API Design
  • Clients can use X-HTTP-Method-Override header, supports Cross Origin Resource Sharing and JSONP
  • Two-way format(media type) conversion both send and receive
    • Pluggable content Formatter framework and api
    • Comes with JSON, XML, Yaml, Amf, and Plist(both XML and Binary) format support
  • Pluggable Authentication schemes
    • OAuth 2 Server
  • Pluggable Filters to effectively manage API usage
    • API Rate Limiting Filter
  • Routing
    • Manual Routing (Annotation)
      • Using @url GET my/custom/url/{param} PHPDoc comments
    • Auto Routing (Reflection)
      • URL to Method mapping
      • URL part to Method parameter mapping
      • Query parameters to Method parameter mapping
      • Request body to Method parameter mapping
  • Cache built-in
    • Client Side Caching support
    • Proxy Caching support
  • API Features
    • Always supports URLEncoded format for simplified input (POST vars)
    • Automatic parameter validation and type conversion
    • API versioning support by URL and/or vendor specific MIME
    • API documentation and discovery using Restler API Explorer
    • Throttling and Performance tuning
  • Management

Git Repository and the Branches

Most stable and recent version is at the master branch, previous versions are in the version branches such as v4, v3, v2, and v1.

Version branch with the current version such as v5 is used for building up the next release. It's documentation may not be updated frequently and thus reserved for the daring ones.

Feature branches such as features/html and features/router are purely for experimentation purpose to try out a feature. They may be merged when ready.

Test Drive

Install this repository to try out the examples.

Make sure PHP 5.4 or above is available on your server. We recommended using the latest version for better performance.

1. Install Composer

Restler uses Composer to manage its dependencies. First, download a copy of composer.phar. It can be kept in your project folder or ideally in usr/local/bin to use it globally for all your projects. If you are on Windows, you can use the composer windows installer instead.

2. Install Restler

Option 1. Using composer create-project

You may install Restler by running the create project command in your terminal. Replace {projectName} with your actual project name. It will create a folder with that name and install Restler.

php composer.phar create-project luracast/restler {projectName}

Note:-

If you do not want the additional formats and BDD tools you can include > --no-dev to enforce exclusion of dev packages.

If you want to try the bleading edge v3 branch or any of the feature > branches include 3.x-dev or dev-features/html in the above command

Option 2. Downloading from GitHub

After installing Composer, download the latest version of the Restler framework and extract its contents into a directory on your server. Next, in the root of your Restler project, run the php composer.phar install (or composer install) command to install all the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.

If you want to update the Restler framework, you may issue the php composer.phar update command.

Note:- If you are not allowed to install composer and git on your server, you can install and run them on your development machine. The resulting files and folders can be uploaded and used on the server.

3. Configure

Ideally public folder should be mapped as your web root, It is optional, but recommended avoiding exposing unneeded files and folders.

4. Try it out

Try the live examples in your localhost.

You may launch the PHP's built-in server with composer serve command.

5. Run some test

Update the base_url specified in behat.yml and then try the following command

vendor/bin/behat

alternatively you can run composer test

This will test the examples against the behaviors expected, for example

Feature: Testing CRUD Example

  Scenario: Creating new Author with JSON
    Given that I want to make a new "Author"
    And his "name" is "Chris"
    And his "email" is "chris@world.com"
    And the request is sent as JSON
    When I request "/examples/_007_crud/authors"
    Then the response status code should be 200
    And the response should be JSON
    And the response has a "id" property

All set, Happy RESTling! :)

View on Github

7 - Wsdl2phpgenerator:

A tool to generate PHP classes from SOAP WSDL files.

Simple WSDL to PHP classes converter. Takes a WSDL file and outputs class files ready to use.

Installation

Add wsdl2phpgenerator to your project using composer:

composer require wsdl2phpgenerator/wsdl2phpgenerator

Contributors

Originally developed by @walle and includes bug fixes and improvements from various contributors.

Contributing

Pull requests are very welcome. Please read our guidelines for contributing.

Be sure to run the test suite, the fixers and the analyzers

composer test
composer fix
composer analyse

Usage and options

See usage and options for info on the usage of this package.

Versioning

This project uses semantic versioning. The following constitutes the public API:

  • \Wsdl2PhpGenerator\GeneratorInterface
  • \Wsdl2PhpGenerator\ConfigInterface
  • Generated code

Backwards incompatible changes to these means that the major version will be increased. Additional features and bug fixes increase minor and patch versions.

View on Github

Thank you for following this article.

Related videos:

Frameworks - Web Development

#php #apis #web #tools 

7 Favorite PHP Libraries and Web tools for Developing APIs

10 Favorite Golang Libraries for Accessing Third Party APIs

In today's post we will learn about 10 Favorite Golang Libraries for Accessing Third Party APIs. 

What are third party APIs?

Third party APIs are APIs provided by third parties — generally companies such as Facebook, Twitter, or Google — to allow you to access their functionality via JavaScript and use it on your site. One of the most obvious examples is using mapping APIs to display custom maps on your pages.

Table of contents:

  • Airtable - Go client library for the Airtable API.
  • Amazon-product-advertising-api - Go Client Library for Amazon Product Advertising API.
  • Anaconda - Go client library for the Twitter 1.1 API.
  • Appstore-sdk-go - Unofficial Golang SDK for AppStore Connect API.
  • AWS-sdk-go - The official AWS SDK for the Go programming language.
  • Bqwriter - High Level Go Library to write data into Google BigQuery at a high throughout.
  • Brewerydb - Go library for accessing the BreweryDB API.
  • Cachet - Go client library for Cachet (open source status page system).
  • Circleci - Go client library for interacting with CircleCI's API.
  • Clarifai - Go client library for interfacing with the Clarifai API.

1 - Airtable: 

Go client library for the Airtable API.

Installation

The Golang Airtable API has been tested compatible with Go 1.13 on up.

go get github.com/mehanizm/airtable

Basic usage

Initialize client

You should get your_api_token in the airtable account page

client := airtable.NewClient("your_api_token")

Get table

To get the your_database_ID you should go to main API page and select the database.

table := client.GetTable("your_database_ID", "your_table_name")

List records

To get records from the table you can use something like this

records, err := table.GetRecords().
	FromView("view_1").
	WithFilterFormula("AND({Field1}='value_1',NOT({Field2}='value_2'))").
	WithSort(sortQuery1, sortQuery2).
	ReturnFields("Field1", "Field2").
	InStringFormat("Europe/Moscow", "ru").
	Do()
if err != nil {
	// Handle error
}

Add records

recordsToSend := &airtable.Records{
    Records: []*airtable.Record{
        {
            Fields: map[string]interface{}{
                "Field1": "value1",
                "Field2": true,
            },
        },
    },
}
receivedRecords, err := table.AddRecords(recordsToSend)
if err != nil {
	// Handle error
}

View on Github

2 - Amazon-product-advertising-api: 

Go Client Library for Amazon Product Advertising API.

How to Use

go get -u github.com/ngs/go-amazon-product-advertising-api/amazon
package main

import (
	"fmt"
	"log"

	"github.com/ngs/go-amazon-product-advertising-api/amazon"
)

func main() {
	client, err := amazon.NewFromEnvionment()
	if err != nil {
		log.Fatal(err)
	}
	res, err := client.ItemSearch(amazon.ItemSearchParameters{
		SearchIndex: amazon.SearchIndexBooks,
		Keywords:    "Go 言語",
	}).Do()
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%d results found\n\n", res.Items.TotalResults)
	for _, item := range res.Items.Item {
		fmt.Printf(`-------------------------------
[Title] %v
[URL]   %v
`, item.ItemAttributes.Title, item.DetailPageURL)
	}
}
export AWS_ACCESS_KEY_ID=${YOUR_AWS_ACCESS_KEY_ID}
export AWS_SECRET_ACCESS_KEY=${YOUR_AWS_SECRET_ACCESS_KEY}
export AWS_PRODUCT_REGION=JP
export AWS_ASSOCIATE_TAG=ngsio-22

go run item_search.go

View on Github

3 - Anaconda:

Go client library for the Twitter 1.1 API.

Anaconda is a simple, transparent Go package for accessing version 1.1 of the Twitter API.

Successful API queries return native Go structs that can be used immediately, with no need for type assertions.

Examples

Authentication

If you already have the access token (and secret) for your user (Twitter provides this for your own account on the developer portal), creating the client is simple:

api := anaconda.NewTwitterApiWithCredentials("your-access-token", "your-access-token-secret", "your-consumer-key", "your-consumer-secret")

Queries

Queries are conducted using a pointer to an authenticated TwitterApi struct. In v1.1 of Twitter's API, all requests should be authenticated.

searchResult, _ := api.GetSearch("golang", nil)
for _ , tweet := range searchResult.Statuses {
    fmt.Println(tweet.Text)
}

Certain endpoints allow separate optional parameter; if desired, these can be passed as the final parameter.

//Perhaps we want 30 values instead of the default 15
v := url.Values{}
v.Set("count", "30")
result, err := api.GetSearch("golang", v)

(Remember that url.Values is equivalent to a map[string][]string, if you find that more convenient notation when specifying values). Otherwise, nil suffices.

Streaming

Anaconda supports the Streaming APIs. You can use PublicStream* or UserStream API methods. A go loop is started an gives you an stream that sends interface{} objects through it's chan C Objects which you can cast into a tweet, event and more.

v := url.Values{}
s := api.UserStream(v)

for t := range s.C {
  switch v := t.(type) {
  case anaconda.Tweet:
    fmt.Printf("%-15s: %s\n", v.User.ScreenName, v.Text)
  case anaconda.EventTweet:
    switch v.Event.Event {
    case "favorite":
      sn := v.Source.ScreenName
      tw := v.TargetObject.Text
      fmt.Printf("Favorited by %-15s: %s\n", sn, tw)
    case "unfavorite":
      sn := v.Source.ScreenName
      tw := v.TargetObject.Text
      fmt.Printf("UnFavorited by %-15s: %s\n", sn, tw)
    }
  }
}

View on Github

4 - Appstore-sdk-go: 

Unofficial Golang SDK for AppStore Connect API.

Download

go get -u github.com/kachit/appstore-sdk-go

Usage

package main

import (
    "fmt"
    "time"
    appstore_sdk "github.com/kachit/appstore-sdk-go/v1"
)

func main(){
    cfg := appstore_sdk.NewConfig("Issuer Id", "Key Id", "Vendor No", "path/to/your/private.key")
    client := appstore_sdk.NewClientFromConfig(cfg, nil)
    
    //Build auth token
    err := client.Init()
    if err != nil {
        fmt.Printf("Wrong API client init " + err.Error())
        panic(err)
    }
}

Get sales reports

ctx := context.Background()
date, _ := time.Parse("2006-01-02", "2020-05-05")
filter := appstore_sdk.NewSalesReportsFilter()
filter.SubTypeSummary().Version10().Daily().SetReportDate(date)

result, resp, err := client.SalesReports().GetSalesReports(ctx, filter)
if err != nil {
    fmt.Printf("Wrong API request " + err.Error())
    panic(err)
}

//Dump raw response
fmt.Println(resp)

//Dump result
fmt.Println(result.Data[0].Provider)
fmt.Println(result.Data[0].ProviderCountry)
fmt.Println(result.Data[0].SKU)
fmt.Println(result.Data[0].Developer)
fmt.Println(result.Data[0].Title)
fmt.Println(result.Data[0].Version)
fmt.Println(result.Data[0].ProductTypeIdentifier)
fmt.Println(result.Data[0].Units.Value())
fmt.Println(result.Data[0].AppleIdentifier.Value())
fmt.Println(result.Data[0].DeveloperProceeds.Value())
fmt.Println(result.Data[0].BeginDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].EndDate.Value().Format(CustomDateFormatDefault))
fmt.Println(result.Data[0].CustomerCurrency)
fmt.Println(result.Data[0].CountryCode)
fmt.Println(result.Data[0].CurrencyOfProceeds)
fmt.Println(result.Data[0].AppleIdentifier.Value())
fmt.Println(result.Data[0].CustomerPrice.Value())
fmt.Println(result.Data[0].PromoCode)
fmt.Println(result.Data[0].ParentIdentifier)
fmt.Println(result.Data[0].Subscription)
fmt.Println(result.Data[0].Period)
fmt.Println(result.Data[0].Category)
fmt.Println(result.Data[0].CMB)
fmt.Println(result.Data[0].Device)
fmt.Println(result.Data[0].SupportedPlatforms)
fmt.Println(result.Data[0].ProceedsReason)
fmt.Println(result.Data[0].PreservedPricing)
fmt.Println(result.Data[0].Client)
fmt.Println(result.Data[0].OrderType)

View on Github

5 - AWS-sdk-go:

The official AWS SDK for the Go programming language.

AWS-sdk-go is the official AWS SDK for the Go programming language.

Getting Started

Installing

Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.

go get github.com/aws/aws-sdk-go

To update the SDK use go get -u to retrieve the latest version of the SDK.

go get -u github.com/aws/aws-sdk-go

Dependencies

The SDK includes a vendor folder containing the runtime dependencies of the SDK. The metadata of the SDK's dependencies can be found in the Go module file go.mod or Dep file Gopkg.toml.

Go Modules

If you are using Go modules, your go get will default to the latest tagged release version of the SDK. To get a specific release version of the SDK use @<tag> in your go get command.

go get github.com/aws/aws-sdk-go@v1.15.77

To get the latest SDK repository change use @latest.

go get github.com/aws/aws-sdk-go@latest

Go 1.5

If you are using Go 1.5 without vendoring enabled, (GO15VENDOREXPERIMENT=1), you will need to use ... when retrieving the SDK to get its dependencies.

go get github.com/aws/aws-sdk-go/...

This will still include the vendor folder. The vendor folder can be deleted if not used by your environment.

rm -rf $GOPATH/src/github.com/aws/aws-sdk-go/vendor

View on Github

6 - Bqwriter:

High Level Go Library to write data into Google BigQuery at a high throughout.

A Go package to write data into Google BigQuery concurrently with a high throughput. By default the InsertAll() API is used (REST API under the hood), but you can configure to use the Storage Write API (GRPC under the hood) as well.

The InsertAll API is easier to configure and can work pretty much out of the box without any configuration. It is recommended to use the Storage API as it is faster and comes with a lower cost. The latter does however require a bit more configuration on your side, including a Proto schema file as well. See the Storage example below on how to do this.

A third API is available as well, and is a bit different than the other ones. A streamer using the batch API expects the data to be written be an io.Reader of which encoded rows can be read from, in order to be batch loaded into BigQuery. As such its purpose is different from the other 2 clients, and is meant more in an environment where a lot of data has to be loaded at once into big query, rather than being part of a constant high-speed high-throughput environment.

See https://cloud.google.com/bigquery/docs/batch-loading-data for more information about the Batch API, and see the Batch example below on how to do create and use the Batch-driven Streamer.

Note that (gcloud) Authorization is implemented in the most basic manner. Write Error Handling is currently not possible either, making the Streamer a fire-and-forget BQ writer. Please read the sections on these to topics for more information and please consult he Contributing section section explains how you can actively help to get this supported if desired.

Install

import "github.com/OTA-Insight/bqwriter"

To install the packages on your system, do not clone the repo. Instead:

Change to your project directory:

cd /path/to/my/project

Get the package using the official Go tooling, which will also add it to your Go.mod file for you:

go get github.com/OTA-Insight/bqwriter

NOTE: This package is under development, and may occasionally make backwards-incompatible changes.

View on Github

7 - Brewerydb:

Go library for accessing the BreweryDB API.

usage

import "github.com/naegelejd/brewerydb"

Construct a new Client using your BreweryDB API key:

client := brewerydb.NewClient("<your API key>")

Then use the available services to access the API. For example:

// Get any random beer
beer, _ := client.Beer.Random(&brewerydb.RandomBeerRequest{ABV: "8"})
fmt.Println(beer.Name, beer.Style.Name)

or

// Get all breweries established in 1983
bs, err := client.Brewery.List(&brewerydb.BreweryListRequest{Established: "1983"})
if err != nil {
    panic(err)
}
for _, b := range bs {
    fmt.Println(b.Name, b.Website)
}

or

// "What is in Dragon's Milk?"
bl, _ := client.Search.Beer("Dragon's Milk", nil)

var beerID string
for _, beer := range bl.Beers {
    if beer.Name == "Dragon's Milk" {
        beerID = beer.ID
    }
}
if beerID == "" {
    panic("Dragon's Milk not found")
}

ingredients, _ := client.Beer.ListIngredients(beerID)
adjuncts, _ := client.Beer.ListAdjuncts(beerID)
fermentables, _ := client.Beer.ListFermentables(beerID)
hops, _ := client.Beer.ListHops(beerID)
yeasts, _ := client.Beer.ListYeasts(beerID)

fmt.Println("Dragon's Milk:")
fmt.Println("  Ingredients:")
for _, ingredient := range ingredients {
    fmt.Println("    " + ingredient.Name)
}
fmt.Println("\n  Adjuncts:")
for _, adjunct := range adjuncts {
    fmt.Println("    " + adjunct.Name)
}
fmt.Println("  Fermentables:")
for _, fermentable := range fermentables {
    fmt.Println("    " + fermentable.Name)
}
fmt.Println("  Hops:")
for _, hop := range hops {
    fmt.Println("    " + hop.Name)
}
fmt.Println("  Yeasts:")
for _, yeast := range yeasts {
    fmt.Println("    " + yeast.Name)
}

View on Github

8 - Cachet:

Go client library for Cachet (open source status page system).

Installation

It is go gettable

$ go get github.com/andygrunwald/cachet

(optional) to run unit / example tests:

$ cd $GOPATH/src/github.com/andygrunwald/cachet
$ go test -v ./...

API

Please have a look at the GoDoc documentation for a detailed API description.

Authentication

Cachet supports two different ways for authentication: BasicAuth and API Token. Both are supported by this library.

For BasicAuth you need to call the AuthenticationService and apply your email address and your password:

client.Authentication.SetBasicAuth("test@test.com", "test123")

To use the API Token way, you do nearly the same but use the SetTokenAuth function:

client.Authentication.SetTokenAuth("MY-SECRET-TOKEN")

Examples

Further a few examples how the API can be used. A few more examples are available in the GoDoc examples section.

Ping

Call the API test endpoint. Example without error handling. Full example available in the GoDoc examples section.

package main

import (
    "fmt"
    "github.com/andygrunwald/cachet"
)

func main() {
    client, _ := cachet.NewClient("https://demo.cachethq.io/", nil)
    pong, resp, _ := client.General.Ping()

    fmt.Printf("Result: %s\n", pong)
    fmt.Printf("Status: %s\n", resp.Status)

    // Output: Result: Pong!
    // Status: 200 OK
}

View on Github

9 - Circleci:

Go client library for interacting with CircleCI's API. Supports all current API endpoints allowing you do do things like:

  • Query for recent builds
  • Get build details
  • Retry builds
  • Manipulate checkout keys, environment variables, and other settings for a project

The CircleCI HTTP API response schemas are not well documented so please file an issue if you run into something that doesn't match up.

Example usage:

package main

import (
        "fmt"

        "github.com/jszwedko/go-circleci"
)

func main() {
        client := &circleci.Client{Token: "YOUR TOKEN"} // Token not required to query info for public projects

        builds, _ := client.ListRecentBuildsForProject("jszwedko", "circleci-cli", "master", "", -1, 0)

        for _, build := range builds {
                fmt.Printf("%d: %s\n", build.BuildNum, build.Status)
        }
}

For the CLI that uses this library (or to see more example usages), please see circleci-cli.

View on Github

10 - Clarifai:

Go client library for interfacing with the Clarifai API.

Disclaimer

This API client only supports Clarifai v1 API. Stay tuned for the v2 support.

Usage

go get github.com/clarifai/clarifai-go

package main

import (
	"fmt"

	"github.com/clarifai/clarifai-go"
)

func main() {
	client := clarifai.NewClient("<client_id>", "<client_secret>")
	// Get the current status of things
	info, err := client.Info()
	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%+v\n", info)
	}
	// Let's get some context about these images
	urls := []string{"https://samples.clarifai.com/metro-north.jpg", "https://samples.clarifai.com/puppy.jpeg"}
	// Give it to Clarifai to run their magic
	tag_data, err := client.Tag(clarifai.TagRequest{URLs: urls})

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%+v\n", tag_data) // See what we got!
	}

	feedback_data, err := client.Feedback(clarifai.FeedbackForm{
		URLs:    urls,
		AddTags: []string{"cat", "animal"},
	})

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Printf("%+v\n", feedback_data)
	}
}

Testing

Run go test

View on Github

Thank you for following this article.

Related videos:

Let's build a REST API in Go with zero dependencies!

#go #golang #apis 

10 Favorite Golang Libraries for Accessing Third Party APIs
Jack  C

Jack C

1663145220

Top 30 Blockchain APIs for development projects

Blockchain APIs enable blockchain developers to develop blockchain applications that can communicate with blockchain networks, nodes, and clients via an API.

 Blockchain APIs facilitate all aspects of blockchain data transfer and node communication for decentralized applications and blockchain systems.

In this article you will see the top 30 Blockchain APIs for development projects

1. Blockchain API

NameDescribeAPIs address
Blockchain APIBlockchain API is a perfect solution for implementing the cryptocurrency payment functionality. With a community of over 25,000 developers, the Blockchain API technology is considered to be the oldest and the most popular one. Blockchain has APIs for wallets, payment processing, blockchain exploration, and simple text query. They also provide WebSockets, market data API.

Blockchain API stores data on blocks and transactions in JSON format. It has low timeouts, and it operates using wallets only. This avoids the need for additional cryptocurrency storage. 

On balance, this Blockchain API is competitive because of:

Vast developer community;
Low timeouts;
Accessible JSON data format;
Access for operations via e-wallet accounts.
APIs

 

2. CryptoCompare

NameDescribeAPIs address
CryptoCompareCryptoCompare is used by a wide range of businesses, investment institutions, and crypto companies. CryptoCompare includes a variety of data from market, trade, blockchain, and social sources.

CryptoCompare’s API provides highly reliable and scalable endpoints, reaching 180 million requests per hour at peak times and collecting 800+ trades per second. Their global data centers support over 30k clients.
APIs

3. Nomics

NameDescribeAPIs address
Nomics
Nomics is a cryptocurrency data API focused on Price, crypto market cap, supply, and all-time high data. They offer Candle/OHLC data for currencies & exchanges. Additionally, they supply historical aggregate cryptocurrency market cap since January of 2013.

Nomics API is a resource for all developers. Their prices can seem expensive to the typical developer who is searching for a cheap or free crypto API. Nonetheless, they are a well respected API within the crypto industry.
APIs

4. CoinCap

NameDescribeAPIs address
CoinCapCoinCap is a tool that collects real-time pricing and market activity for over 1,000 cryptocurrencies, with the goal of providing transparent and accurate data on digital asset markets. Created by the ShapeShift team, CoinCap API is free for all users.

CoinCap API functions well as a free API for aggregating real-time prices and markets but can fall short as a solution that requires accurate historical data, such as backtesting portfolio strategies.
APIs

5. Cryptoapis

NameDescribeAPIs address
CryptoapisCryptoapis.io is a mostly RESTful JSON API for interacting with blockchains. 

Crypto APIs provides interoperability, through a coherent and advanced integration, with our all-in-one platform for crypto exchange market data and powerful blockchain endpoints.
APIs

6. Web3.js API

NameDescribeAPIs address
Web3.js APIWeb3.js is the primary API for the Ethereum network; however, to use it, you would need to run your own Ethereum client. 

You also can use Infura hosting instead. It has wallet support, autogenerates wrappers for smart contracts from native java code. It has support for both ERC20 and ERC721 token standards. 

Its features are:

There is a right amount of documentation and extensions for it;
It uses JavaScript, so development isn’t expensive;
It’s free;
You have to run your node to use it.
APIs

7. Infura

NameDescribeAPIs address
InfuraInfura is one of the biggest blockchain service providers today – it offers a robust, scalable solution for a client infrastructure in the Ethereum network.

It is useful for decentralized apps and also has other uses. Infura also provides a backend API to connect apps through HTTP and WebSockets to Ethereum network IPFS storage. 
APIs

8. Tierion

NameDescribeAPIs address
TierionTierion provides a curious solution called Chainpoint. This API allows you to make incomparable timestamps in the blockchain linked to a file you have. 

This timestamp can’t be removed or tampered with. It can be useful for legal reasons, for instance, to prove IP or timestamp a piece of research or to create an audit trail. Many apps are getting developed using this API. 

This technology is new. But there are cases already of using blockchain anchoring as evidence in court successfully.
APIs

9. LunarCRUSH

NameDescribeAPIs address
LunarCRUSHLunarCRUSH provides API endpoints for thousands of crypto assets. This is the same API that drives their web app. Access over 100 million collected social posts, all classified by coin using artificial intelligence and displayed alongside unique insights. 

The cryptocurrency focused company collects more than 100,000 social posts with 20,000 links per day and they support more than 2000 cryptocurrencies. 

LunarCRUSH is known as one the most reliable API for community and social insights.
APIs

10. Messari

NameDescribeAPIs address
MessariMessari provides API endpoints for thousands of crypto assets. These endpoints include trades, market data (VWAP), quantitative metrics, qualitative information. 

This is the same API that drives their web app. Most of their endpoints are available without an API key, but they limit their rates. 

The free tier does not include redistribution rights and requires attribution and a link back to their site.

Generally, Messari is a good API for those looking to build custom solutions. While their site has good information for traders, developing with their API can be challenging.
Messari provides API endpoints for thousands of crypto assets. These endpoints include trades, market data (VWAP), quantitative metrics, qualitative information. 

This is the same API that drives their web app. Most of their endpoints are available without an API key, but they limit their rates. 

The free tier does not include redistribution rights and requires attribution and a link back to their site.
APIs

11. Moralis

NameDescribeAPIs address
MoralisMoralis enables developers to build serverless Web3 (Ethereum node interaction) dApps (decentralized applications). 

The Moralis API enables developers to access the platform manage blockchain data, including NFT (non-fungible tokens) data. Methods are available to manage native block data, NFT data, accounts, tokens, transfers, events, addresses, owners
APIs

12. NFTPort

NameDescribeAPIs address
NFTPortNFTPort is "the Stripe for NFTs" (non-fungible tokens), a service that offers developer tools to bring their NFT applications to market. 

The NFTPort API offers programmatic access to the service, with methods to manage visual search, easy minting, text search, account, contract, advanced minting, NFT retrieval, user profile
APIs

13. PureStake

NameDescribeAPIs address
PureStakePureStake provides tools and Blockchain infrastructure services for Proof of Stake networks. The PureStake offers access to the Algorand (cryptocurrency) network without having to maintain node infrastructure. 

The API is accessible indirectly by SDKs and offers access to query historical information from the blockchain, get information about blocks and transactions, and send transactions.
APIs

14. FIO Protocol

NameDescribeAPIs address
FIO ProtocolThe FIO (Foundation for Interwallet Operability) API allows developers to access blockchain information such as transactions, blocks, fee ratios, Tokens, and addresses. 

The API features REST architecture, JSON payload requests, and JSON responses. FIO Protocol is a consortium of leading wallets, exchanges, and crypto payment processors. This protocol is a decentralized service that removes the risk of sending and receiving coins and Tokens across every blockchain.
APIs

15. Zilliqa API

NameDescribeAPIs address
Zilliqa APIThe Zilliqa API enables developers to integrate blockchain related methods with their applications. Blockchain, transaction, contract and account methods are supported. 

Zilliqa is a high-performance, high-security blockchain designed for enterprise applications. Zilliqa enables real-world usability across different industries including digital advertising, gaming, and finance.
APIs

16. ThreeFold

NameDescribeAPIs address
ThreeFoldThreeFold leverages blockchain to build storage and compute applications such as IoT, Machine Learning, and Artificial Intelligence. 

ThreeFold features globally distributed nodes, autonomous deployment technology, and a peer-to-peer layer for frontend applications. The ThreeFold Token is a decentralized digital currency that represents a unit of reservation of capacity for computing and storing data.
APIs

17. Horizen

NameDescribeAPIs address
HorizenHorizen is an inclusive ecosystem for decentralized applications. Horizen's ZEN is a cryptocurrency with full end-to-end encryption. 

Horizen offers an optional privacy feature that allows the control of digital footprints. Horizen is equipped with zk-SNARK privacy technology and a decentralized multi-tiered node architecture.
APIs

18. 0x 

NameDescribeAPIs address
0xThe 0x API provides methods to source liquidity from 0x Mesh, Kyber, Uniswap, Oasis, and decentralized exchange networks. With the API, developers can route transactions across decentralized exchange networks to find the lowest slippage possible. 

0x API automatically creates an order that can be passed directly to smart contracts to be settled on-chain. No API key is required. 0x offers liquidity, fast response times and low revert rates, flexible integration, and open-source terms.
APIs

19. Request Network

NameDescribeAPIs address
Request NetworkThe Request Network API is a RESTful service that enables users to interact with the Request Protocol, abstracting all Blockchain-related aspects. Use the API to create Requests, list Requests, and find a specific Request by its ID. 

The Request service uses an API Key to authenticate requests, and supports JSON-encoded requests and responses. Request Network is an Open Financial Network for transaction requests that includes support for; blockchain, invoicing, ethereum and more. 

This API is currently in alpha, and is running on the Rinkeby Ethereum test network. Please check the Request Network roadmap to learn more about the Protocol release to the Ethereum Mainnet.‌‌
APIs

20. BlockCypher

NameDescribeAPIs address
BlockCypherThe BlockCypher Webhooks API allows you to leverage objects and interactions in BlockCypher payments services. 

This includes notifications for new transaction BlockCypher receives, every new block added, every new transactions and more. BlockCypher provides infrastructure and support services to build applications and web services for blockchain applications.
APIs

21. Dfuse

NameDescribeAPIs address
DfuseThe dfuse API returns JSON formats to build EOS blockchain crypto applications. Developers can get a free API Key to work with REST and WebSockets.APIs

22. Cosmos

NameDescribeAPIs address
CosmosCosmos offers an integrated cryptocurrency platform with wallet, dashboard, and miner. Any blockchain system can be incorporated into the Cosmos hub directly, without intermediaries. 

The Cosmos platform uses Byzantine fault tolerance (BFT) theory to tolerate machines failing in arbitrary ways. Additionally, Cosmos uses Tendermint for securely and consistently replicating an application on many machines.
APIs

23. Hydrogen

NameDescribeAPIs address
HydrogenThe Hydro API enables applications to interface with Hydro’s smart contracts. All Hydrogen APIs are built on REST principles, with resource-oriented URLs and HTTP response codes. All API responses are returned in JSON format. APIs

24. Waves Platform

NameDescribeAPIs address
Waves PlatformWaves Platform is a provider of blockchain solutions for building trading platforms. The Waves Node API provides RESTful platform for implementing blockchain functionality in trading apps. Use the API to integrate a variety of functionalities including orders, transaction history, and balances.APIs

25. Polygon

NameDescribeAPIs address
PolygonThe Polygon API returns JSON responses to get companies, trades, historic quotes, currencies, forex ticks, and currency trades data. Polygon streams stocks and market data in real-time.APIs

26. Ripple

NameDescribeAPIs address
RippleRipple was created to provide a free, open-source, payment service that exist without a central authority. It is open-source, almost free to use, an can pay out in an currency. The Ripple API allows users to integrate the Ripple payment system and platform into third-party projects.APIs

27. Cex.io

NameDescribeAPIs address
Cex.ioCex.io is a cryptocurrency exchange platform. Integration of the Cex.io WebSocket API allows you to access real time notifications without sending extra requests. This expedites data transmission from the exchange.APIs

28. MultiChain

NameDescribeAPIs address
MultiChainThe MultiChain API boasts "feeling at home" if you’re familiar with bitcoin. The API has maximal compatibility with Bitcoin Core, the reference client for the bitcoin network. As a fork of Bitcoin Core, MultiChain shares the following technical characteristics: Command-line arguments, Network protocol, JSON-RPC API, Transaction format, Script language, and Block format. 

The robust documentation offers basics of working with MultiChain such as: "How to create or connect to a blockchain", "Customizing your blockchain parameters and API commands for controlling MultiChain", as well as information about compatibility with Bitcoin Core.
APIs

Conclusion

Before choosing the best Blockchain API, examine the documentation to understand what data is accessible, any rate-limiting difficulties, and your anticipated data consumption pricing. Some of these APIs include language-specific libraries that are officially supported to assist developers in getting started quickly.

Top exchanges for token-coin trading: ☞ BinancePoloniexBitfinexHuobiMXCProBITGate.io

I hope this article will help you. Don't forget to leave a like, comment and sharing it with others. Thank you!

#blockchain #bitcoin #cryptocurrency #api #apis 

Top 30 Blockchain APIs for development projects
Coding  Fan

Coding Fan

1662532660

How to Test REST APIs using Curl Command | Test CRUD APIs

Curl is a free and open source command line tool and library for transferring data with URLs. It is widely-used by developers for quickly testing REST APIs in command line. In this video, I’d like to share with you how to test REST APIs using curl. In other words, you will learn how to use curl’s options for testing CRUD APIs (Create, Retrieve, Update and Delete).

In this video, you’ll learn how to test REST APIs using curl command – Test CRUD APIs:
- Test Create API with curl
- Test Read/Retrieve API with curl
- Test Update API with curl (full update and partial update)
- Test Delete API with curl

We show you the basic syntax of curl and some common options.

For written guide, check this article: https://www.codejava.net/rest-api/curl-for-testing-crud-rest-apis 

Subscribe: https://www.youtube.com/c/CodeJava/featured 

#apis #restapi 

How to Test REST APIs using Curl Command | Test CRUD APIs
Hunter  Krajcik

Hunter Krajcik

1660437240

Encode, Decode Continuation token Values for Stateless Pagination APIs

Encode and decode continuation token values for stateless pagination APIs.

Continuation data is a free-form Map that is:

  • encoded as JSON String
  • encoded as UTF-8 bytes
  • XOR-d with a given bytes of secret (optional)
  • encoded as BASE-64 String

Usage

A simple usage example:

import 'package:continuation_token/continuation_token.dart';

main() {
  final codec = jsonMapContinuationCodec(secret: 'my-secret');

  final token = codec.encode({'id': 'abc123', 'asc': true});
  print(token); // FltEF0dZUAQWDkgfQEdPUAQHDlsXBxcWFxg

  final data = codec.decode(token);
  print(data); // {id: abc123, asc: true}
}

Installing

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add continuation_token

With Flutter:

 $ flutter pub add continuation_token

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  continuation_token: ^2.1.0

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:continuation_token/continuation_token.dart';

example/example.dart

import 'package:continuation_token/continuation_token.dart';

main() {
  final codec = jsonMapContinuationCodec(secret: 'my-secret');

  final token = codec.encode({'id': 'abc123', 'asc': true});
  print(token); // FltEF0dZUAQWDkgfQEdPUAQHDlsXBxcWFxg

  final data = codec.decode(token);
  print(data); // {id: abc123, asc: true}
}

Download Details:

Author: isoos
Source Code: https://github.com/isoos/continuation-token 
License: BSD-3-Clause license

#flutter #dart #apis 

Encode, Decode Continuation token Values for Stateless Pagination APIs
Ben Taylor

Ben Taylor

1659930120

Cryptocurrency APIs: Top 200 APIs for Developer and Traders

Development using data from the cryptocurrency market is emerging as the new cryptocurrency gold rush. APIs permit several businesses to hold access to a broad range of resources. Additionally, these APIs assist you to check real-time crypto data to assist in building a trading bot, executing academic research on cryptocurrency.

In this article, you'll learn What is Cryptocurrency APIs, Top 200 APIs for Developer and Traders.

What is an API?

API, or Application Programming Interface, connects multiple user programs. An API sends your request to a server with the information you need and then returns the response to your device.

The current API has its software development lifecycle (SDLC), which includes designing, testing, developing, maintaining, and versioning, much like any other productized software. Modern APIs are also fully documented in terms of usage and versioning.

What is a CryptoCurrency APIs?

The biggest thing that all crypto currency API must do is to interface with crypto currencies. Most of the best will work with several different crypto currencies, while some of the more limited API will only work with one of the more mainstream currencies.

Some crypto currency API work similarly to a stock market or currency exchange API, providing lots of detail on market trends. They monitor the prices of multiple different crypto currencies, including fluctuations in pricing, and monitoring for overall market trends.

These crypto currencies also generally provide some kind of historical data following each crypto currency, though the quality and length of the data depends greatly on how long each crypto currency has been around.

These market monitoring and trade API also usually have some buy/sell abilities, which also come with a wallet for your crypto currency, much like a stock market portfolio. Some will also work with websites and stores that accept crypto currency for payment, although not all.

Others are more limited and function mostly as a crypto currency wallet, though that is slightly rarer. Still, others are only market monitors, providing data on the current price of each covered currency, but without buy/sell options.

Still, others work to help connect you to stores where you can use your crypto currency or else sell for a range of base currencies.

You can also implement other API that complement your crypto currency API to help build a better project. Consider security features like email verification or phone verification a priority for many crypto currency based projects. 

What products does Crypto APIs offer?

Crypto APIs is a set of blockchain- and crypto-related products which can help you reduce your development and infrastructure costs. It's an infrastructure layer which significantly reduces your go to market time.

  • Wallet as a Service - an MPC digital wallet that incorporates the best features, security and authorization processes on the market.
  • Blockchain Data - Unified access to complex and dynamic blockchain data from a single point using REST APIs.
  • Blockchain Events - monitor and be notified for webhooks on top blockchain protocols using unified requests and callbacks
  • Node as a Service - shared and dedicated node infrastructure for top blockchains using JSON-RPC.
  • Blockchain Tools - a collection of API endpoints that provide an easy connection with blockchains and perform certain operations.
  • Blockchain Automations - forward automatically any received coins or tokens to a preferred main deposit address.
  • Market Data - real-time and historical crypto market data in one place.

Use Cases for Crypto APIs

  • Crypto Wallet: Chances are, your phone already has a digital wallet that stores some of your credit card data for online and in-person purchases. In a similar vein, crypto wallets help manage the public/private key pairs that control ownership of the underlying crypto. They serve as a central location where you can manage your crypto and connect to decentralized applications (dApps). Crypto wallet APIs link to different digital currencies and perform various functions for convenience purposes. Take Binance API as an example – it lets you set up a “kill switch” on your wallet for immediate crypto sales, order placements, and open order cancellations.
  • Digital Banks: APIs for digital banking platforms allow banks to integrate with crypto banking services to enable lending, maintain accounts, make payments and accept deposits. It also allows banks to notify customers about their balances and fees. In doing so, banks could potentially attract new customers and further engage with existing customers.
  • Portfolio Tracking: Crypto APIs can be used to feed historical, live blockchain, and market data to portfolio management software or portfolio trackers, enabling users to manage their crypto holdings more effectively. These APIs can provide the portfolio holder with information such as transactions made from a particular address, track fees paid in a specific transaction or transaction period, monitor deposits and withdrawals, etc.
  • Crypto Exchanges: APIs also can connect you with historical data and staking interests and sort coins by market cap and volume. For example, Coinbase’s FIX / REST exchange APIs and WebSocket feeds can “provide direct access to order placement and provide real time market data.”
  • Crypto Custody: Crypto custody APIs from crypto custody providers integrate with crypto wallets and other digital currency management applications to store and secure crypto assets – especially the private key that verifies those assets' owners.
  • Crypto Mining: Crypto mining APIs can connect crypto mining applications with information from a specific blockchain — providing details about a block's miner, notifying the user when blocks are created or reverted.
  • Crypto Lending: APIs for crypto lenders can ease the task of verifying asset ownership and history, the borrower's net worth, and credit. Lending platforms using crypto APIs can help users borrow and lend crypto directly to one another and collect interest.
  • Crypto Taxes and Accounting: Understanding crypto taxes is essential not only at tax time, but also from the minute someone buys their first coin. Linking a digital wallet or trading app to a crypto taxes app can allow users keep track of their crypto purchases and sales along with their gains and losses. They can then decide which accounting method will be most advantageous to them for tax purposes.
  • Crypto PSP: When building a cryptocurrency payment service provider (PSP), crypto APIs can notify users about deposits and withdrawals, convert one currency to another via an exchange or liquidity provider, generate addresses for deposits, and more.
  • Blockchain Explorer: When developing these tools that are similar to search engines, with which users can search for and explore data on a blockchain, APIs can be used to connect a blockchain explorer to blockchain nodes. Crypto APIs can also sync and refresh blockchain data.

How to Use a Crypto Currency API?

The first thing you'll need if you want to use one is the relevant API key. If you're using a free trial version of an API to test how it works for your project, you may need to get a second API key if you decide to subscribe.

All API consist of code that you insert into your program to access the features and functionality of the API. They serve as replacements for building the code functionality yourself, saving you not only the work of coding but also of sourcing the data needed for each feature.

Once you have an API key, you’ll use the documentation provided by the developer to make sure it’s properly implemented.

From there, you can also often go into the coding to make slight modifications to tweak which features and functions are available to app users. You can also configure how often the API makes a call, and other backend information to make sure you’re matching use to the subscription level you’ve chosen.

Even once these steps have been completed, you may need occasional troubleshooting to make sure you’re making the most of the API, and to solve any hiccups you encounter along the way. 

Top exchanges for token-coin trading. Follow instructions and make unlimited money

BinancePoloniexBitfinexHuobiMXCProBITGate.io


Top 200 APIs for Developer and Traders

There are numerous APIs to select from if you are a cryptocurrency trader, speculator, developer, or someone interested in undertaking cryptocurrency research. Many cryptocurrency exchanges have made their APIs public, allowing developers to connect to their platforms. 

 Name SummaryTypeAPIs address
1Blockchain APIBlockchain API is a perfect solution for implementing the cryptocurrency payment functionality. With a community of over 25,000 developers, the Blockchain API technology is considered to be the oldest and the most popular one. Blockchain has APIs for wallets, payment processing, blockchain exploration, and simple text query. They also provide WebSockets, market data API.

Blockchain API stores data on blocks and transactions in JSON format. It has low timeouts, and it operates using wallets only. This avoids the need for additional cryptocurrency storage. 

On balance, this Blockchain API is competitive because of:

Vast developer community;
Low timeouts;
Accessible JSON data format;
Access for operations via e-wallet accounts.
BlockchainAPIs
2CoinAPICoinAPI is a serve supplier that is entirely focused on providing price and market data. With over 20TB of raw marketplace data in its database, CoinAPI has a reputable list for high-quality crypto data in the market. 

CoinAPI provides real-time data stream services and a database of historical market data. CoinAPI has servers located all around the universe, designed to transfer data faithfully and quickly.
CryptoAPIs
3CoinbaseCoinBase API is a little different, with the flexibility to act as an exchange API, a wallet, or any number of other crypto currency functions. It’s designed to be highly flexible and programmable, which means that this API can give you a lot of functionality to create something different from the competition. 

The developer even suggests that you might be able to create entirely new functionalities in your program, using their API. 

It offers direct connections to other CoinBase wallets, letting you handle transactions directly with another user without having to first go to a crypto marketplace. 

It works with bitcoin, bitcoin cash, litecoin, and Ethereum, giving you access to some of the best and most reliable forms of crypto currency. 

You also have access to real-time price information. In addition, you get access to historical data that can help you make an informed decision about the currencies you want to invest in, and when to buy or sell your existing crypto currency. 

Real-time notifications will also keep you up to date the moment something happens in your crypto wallet, whether you receive a payment, or made one, depending on your settings and the status of each trade. 
 
CryptoAPIs
4CoinMarketCapCoinMarketCap is one of the leading and longest-running data providers which was launched in 2013 and gathered across 150 million visits this year. Like CoinGecko, its basic focus is assisting their retail users to track the prices of coins and execute their portfolio.

The API of CoinMarketCap is a bit costly and has some stricter limits to it in comparison to others. Its free tier lets you receive 10,000 calls however comprises no historical data, which you definitely require for lots of use cases like backtesting crypto trading strategies or charting.
CryptoAPIs
5CoinGeckoCoinGecko ’ randomness mission is to empower crypto users and help them gain a better understand of fundamental factors that drive the marketplace. In addition to crypto prices, trade volume, and grocery store capitalization, CoinGecko besides measures community emergence, open-source code growth, events and on-chain metrics for a complete analysis beyond fair technical indicators. 

Operating since 2014, CoinGecko is one of the largest crypto datum providers, tracking closely 3,300 tokens from more than 260 cryptocurrency exchanges. 

CoinGecko is a free-to-use API that provides access to data such as live pricing, deal volume, tickers, exchanges, and historic data. The API besides provides non-market data such as images, development & social community statistics, events, global markets, and central status updates .
CryptoAPIs
6BitPayBitPay is a Bitcoin and cryptocurrency requital central processing unit that enables merchants and consumers to immediately accept cryptocurrency as payment without gamble or price fluctuations. Currently, credit rating cards can charge up to 3 % in action fees on every transaction. 

Compared to credit cards, BitPay entirely charges a compressed 1 % village fee for crypto-to-fiat bank conversion. Furthermore, traditional requital methods require customers to provide sensitive personal information that could lead to fraud and identity larceny. 

The BitPay API can be used to create and manage invoices, publish refunds, manage bills, retrieve real-time rates information, view merchant daybook entries, and much more.
CryptoAPIs
7Binance APIBNB or Binance is one of the best crypto APIs available in the market today. It’s a free and open-source platform and uses 3rd party platform for real-time change in the market. Besides, its API is easy to integrate and likely to get minimal chances of any issues in it.

Binance API helps in making trade easy for their users and due to its popularity in digital currency today, it allows to handle more than 1200 requests every single minute. Being one of the biggest APIs in the market it also allows users with the following:

A user can start or cancel the transaction at any given point of time.
You can sell/purchase directly with the help of its API
In case of any bugs/errors, you can visit the help desk support forum to troubleshoot the identified issue.
CryptoAPIs
8Poloniex APIIn the world of digital currency, Poloniex is among the world’s largest crypto exchanges in the market today. Poloniex is owned by Circle and it uses HTTP and WebSockets for real-time data. Currently, there are more than 7,000,000 trades are happening each day. With the help of this API, developers can easily integrate these functionalities into any 3rd party application. Besides this, there are several other factors which you ought to see for more clarity.

Poloniex API offers minimal latency which makes it different from others.
Its HTTP API helps in retrieving public market data through the public endpoint.
Currently, it supports 7 public methods for HTTP GET in JSON format.
CryptoAPIs
9BitMEXThe BitMEX API allows users to automate their BitMEX trading and account management functions. BitMEX (The Bitcoin Mercantile Exchange) is a cryptocurrency derivatives platform built by financial professionals. The platform is a safe place to hedge risk, since profits are never clawed back. BitMEX employs multi-factor security and uses multi-signature wallets for all transactions.CryptoAPIs
10Kucoin APIIt allows users to do trading over a cryptocurrency platform where they can trade somewhere between 180-210 digital currencies like ETH, BTC, LUNA, etc. It’s easy to integrate and users can easily operate it both via mobile and desktop. Kucoin also allows users to view the trends and historical figures of any crypto in the market before investing and it also helps the user to put their favorites on the watchlist so that they can keep a close eye while they fluctuate. As a developer, you need to keep these points in mind while going to Kucoin API:

Its interface is user friendly
Transparency
Users cannot deposit money via Credit Cards
It covers a vast market with over 200 cryptocurrency
It uses REST API and WebSockets which is easy to integrate
CryptoAPIs
11Gate.ioThe Gate.io API allows developers to make cryptocurrency trades, get an account balance, get a recharge address, get an order's status, cancel an order, and more. This is a RESTful API that uses POST requests. 

Results are returned in JSON format. This API is provided by Gate.io, a website that offers cryptocurrency trading and information services.
CryptoAPIs
12BithumbThe Bithumb Public API allows developers to use REST calls to access cryptocurrency exchange market information. This includes current price information, bid and ask information, transaction history, and the Bithumb Crypto Index (BTCI). Bithumb is a Korean cryptocurrency exchange. API documentation is provided in both Korean and English.CryptoAPIs
13Bittrex APIBittrex is a dependable, secure, and creative digital asset trading platform formed on Bittrex’s cutting-edge technology for crypto traders. 

It has this special point where users can programmatically gain access to their Bittrex accounts and withdrawals, do trades, and make deposits using the Bittrex API.
CryptoAPIs
14OKExThe OKEx Websocket API is designed for spot and margin users. All of the data channels are applicable to both types of users, except for the Account Channel. Developers are strongly advised to use the Websocket API for retrieving market data and order book depth. 

OKEx is a digital asset exchange that provides financial services to traders using blockchain technology. Currently, OKEx does not serve customers in Hong Kong, Cuba, Iran, North Korea, Crimea, Sudan, Malaysia, Syria, USA (and its territories), Bangladesh, Bolivia, Ecuador, or Kyrgyzstan.
CryptoAPIs
15PrimeBitThe PrimeBit API allows developers to access trades, tickers, market data, account information, and orders. PrimeBit is a cryptocurrency platform with support for Bitcoin, Ethereum, and Litecoin transactions. 

PrimeBit's blockchain contracts support up to 200x leverage, fixed value transactions, and no expiration date.
CryptoAPIs
16DigiFinexThe DigiFinex API provides endpoints for public use, private use, spot trading, OTC, and margin trading. The public endpoints can be used to get the ticker price, orderbook, recent trades, candles data, and more. The private endpoints can be used to create, get, and cancel orders as well as transfer assets among accounts and close positions. 

DigiFinex is a digital assets trading platform that focuses on cryptocurrencies such as Bitcoin, Ethereum, and Litecoin.
CryptoAPIs
17Lbank
The Lbank REST API is recommended for developers wanting to perform currency exchange transactions or asset withdrawals with Lbank. 

The API documentation is provided in both English and Chinese. Lbank is a digital asset exchange platform that covers a large number of cryptocurrencies including Bitcoin, Ethereum, Bitcoin Cash, EOS.IO, NEO, Legal Block, and many others.
CryptoAPIs
18UniswapThe Uniswap API provides recent cryptocurrency information designed to help exchange aggregators. 

Developers can access API status, and Uniswap pair data. Responses are JSON formatted. Uniswap is an Ethereum-based protocol for automated Token exchange.
CryptoAPIs
19NowNodesNOWNodes provides access to Explorer and Node APIs. 40+ most popular blockchain networks connected. With NOWNodes you can : • add new blockchain networks, coins, and tokens:

Get a handy accompaniment solution to maintain the network fluent function & quality of serve.

Concentrate on product development while reducing infrastructure costs. The military service has a release plan for up to 20,000 requests per day for any supported net. 

You can start working with blockchain nodes using NOWNodes, free plan is available.
CryptoAPIs
20CryptoCompareCryptoCompare is used by a wide range of businesses, investment institutions, and crypto companies. CryptoCompare includes a variety of data from market, trade, blockchain, and social sources.

CryptoCompare’s API provides highly reliable and scalable endpoints, reaching 180 million requests per hour at peak times and collecting 800+ trades per second. Their global data centers support over 30k clients.
Blockchain APIs
21Nomics
Nomics is a cryptocurrency data API focused on Price, crypto market cap, supply, and all-time high data. They offer Candle/OHLC data for currencies & exchanges. Additionally, they supply historical aggregate cryptocurrency market cap since January of 2013.

Nomics API is a resource for all developers. Their prices can seem expensive to the typical developer who is searching for a cheap or free crypto API. Nonetheless, they are a well respected API within the crypto industry.
Blockchain APIs
22SimpleSwapSimpleSwap provides its customers an excellent opportunity to exchange 500+ cryptocurrencies without sign-up. Being on the market for 4 years, the project has earned the trust and love of crypto enthusiasts.

SimpleSwap API is free and convenient to use. On average, the integration takes one day only. With the help of SimpleSwap API, applications can implement the cryptocurrency exchange service. Developers can design their own crypto services and, using different API methods, get access to all currency pairs, estimated exchange rates, and much more. API uses HTTP protocol, and the responses are delivered through JSON API format.

After registering an affiliate account, partners can get the API keys and customize their own commission from each completed transaction (up to 2%). SimpleSwap API is sustainable and has 99.95% uptime. Different wallets and exchange partners have already integrated this API for their needs.


 
CryptoAPIs
23Wyre API 
Wyre provides crypto apps and services with a regulate and compliant fiat-to-crypto on-ramp. 

Wyre API is a childlike integrated requital solution for crypto startups looking to implement crypto as a requital method acting, quite than traditional requital methods.
CryptoAPIs
24TheGraphThis GraphQL API embraces everything like lending, yield farming rates, borrowing, as well as generally any data on the most significant DeFi protocols. Sadly, you are unable to access market data from The Graph.

Their playing field seems a little confusing at first however it is fun to use once you get the hang of it. TheGraph is exciting due to its business model as it is unlikely any other you have come across. It is supported by a token called Graph Protocol (GRT) that is used to incentivize. TheGraph’s community to turn the data more reliable by indexing the daunting and dynamic data on Ethereum. 
CryptoAPIs
25CoinCapCoinCap is a tool that collects real-time pricing and market activity for over 1,000 cryptocurrencies, with the goal of providing transparent and accurate data on digital asset markets. Created by the ShapeShift team, CoinCap API is free for all users.

CoinCap API functions well as a free API for aggregating real-time prices and markets but can fall short as a solution that requires accurate historical data, such as backtesting portfolio strategies.
BlockchainAPIs
26CryptoapisCryptoapis.io is a mostly RESTful JSON API for interacting with blockchains. 

Crypto APIs provides interoperability, through a coherent and advanced integration, with our all-in-one platform for crypto exchange market data and powerful blockchain endpoints.
BlockchainAPIs
27BitcoreBitcore is a native interface for the Bitcoin network. The popular bitcoin payment processor Bitpay developed it. It’s free, open-source, and coded in JavaScript. It’s a toolset necessary for almost any bitcoin-related application. It includes a node, wallet, bitcoin chain explorer, and many useful libraries. It’s easy to extend it with additional services, thanks to its modular architecture. It’s an advantage for enterprise applications.

Furthermore, Bitcore is a full node, so applications on its API run on the P2P network. This means an incredible performance (over 500 transactions per second). Bitcore productivity makes it one of the best blockchain API for scaling projects. Its potential for excellent performance makes it somewhat futureproof. It eliminates any worries about the need for significant redevelopment in the non-distant future.
 
BlockchainAPIs
28FactomFactom is a company offering a truly innovative solution that goes by the brand name Harmony Connect. It offers services for data storage on its Blockchain. This is helpful when you need to record tamperproof data for prolonged periods of time. 

Their API has good integration with existing software. Factom blockchain can also run smart contracts. Another nice feature of their blockchain is tokenization. You can create tokens that represent real-world assets and trade them over the network. Factom seems like a solution that can be very popular in the near future.
CryptoAPIs
29Web3.js APIWeb3.js is the primary API for the Ethereum network; however, to use it, you would need to run your own Ethereum client. 

You also can use Infura hosting instead. It has wallet support, autogenerates wrappers for smart contracts from native java code. It has support for both ERC20 and ERC721 token standards. 

Its features are:

There is a right amount of documentation and extensions for it;
It uses JavaScript, so development isn’t expensive;
It’s free;
You have to run your node to use it.
BlockchainAPIs
30InfuraInfura is one of the biggest blockchain service providers today – it offers a robust, scalable solution for a client infrastructure in the Ethereum network.

It is useful for decentralized apps and also has other uses. Infura also provides a backend API to connect apps through HTTP and WebSockets to Ethereum network IPFS storage. 
BlockchainAPIs
31TierionTierion provides a curious solution called Chainpoint. This API allows you to make incomparable timestamps in the blockchain linked to a file you have. 

This timestamp can’t be removed or tampered with. It can be useful for legal reasons, for instance, to prove IP or timestamp a piece of research or to create an audit trail. Many apps are getting developed using this API. 

This technology is new. But there are cases already of using blockchain anchoring as evidence in court successfully.
BlockchainAPIs
32LunarCRUSHLunarCRUSH provides API endpoints for thousands of crypto assets. This is the same API that drives their web app. Access over 100 million collected social posts, all classified by coin using artificial intelligence and displayed alongside unique insights. 

The cryptocurrency focused company collects more than 100,000 social posts with 20,000 links per day and they support more than 2000 cryptocurrencies. 

LunarCRUSH is known as one the most reliable API for community and social insights.
BlockchainAPIs
33MessariMessari provides API endpoints for thousands of crypto assets. These endpoints include trades, market data (VWAP), quantitative metrics, qualitative information. 

This is the same API that drives their web app. Most of their endpoints are available without an API key, but they limit their rates. 

The free tier does not include redistribution rights and requires attribution and a link back to their site.

Generally, Messari is a good API for those looking to build custom solutions. While their site has good information for traders, developing with their API can be challenging.
Messari provides API endpoints for thousands of crypto assets. These endpoints include trades, market data (VWAP), quantitative metrics, qualitative information. 

This is the same API that drives their web app. Most of their endpoints are available without an API key, but they limit their rates. 

The free tier does not include redistribution rights and requires attribution and a link back to their site.
BlockchainAPIs
34DexGuru APIDexGuru is a crypto exchange trading terminal. DexGuru Public API enables connected traders to receive on-chain trading data on Ethereum, BSC, Polygon and Avalanche mainnets. 

Data includes current token prices, recent transactions, mints and burns, wallet activity and more.
CryptoAPIs
35MinterstatMinterstat is cryptocurrency mining monitor and management software. 

The Minterstat API offers developer access to the platform, with methods to retrieve and manage online and offline workers, worker statistics, hashrates, worker activity, group statistics, global statistics and more.
CryptoAPIs
36MoralisMoralis enables developers to build serverless Web3 (Ethereum node interaction) dApps (decentralized applications). 

The Moralis API enables developers to access the platform manage blockchain data, including NFT (non-fungible tokens) data. Methods are available to manage native block data, NFT data, accounts, tokens, transfers, events, addresses, owners
BlockchainAPIs
37NFTPortNFTPort is "the Stripe for NFTs" (non-fungible tokens), a service that offers developer tools to bring their NFT applications to market. 

The NFTPort API offers programmatic access to the service, with methods to manage visual search, easy minting, text search, account, contract, advanced minting, NFT retrieval, user profile
BlockchainAPIs
38PureStakePureStake provides tools and Blockchain infrastructure services for Proof of Stake networks. The PureStake offers access to the Algorand (cryptocurrency) network without having to maintain node infrastructure. 

The API is accessible indirectly by SDKs and offers access to query historical information from the blockchain, get information about blocks and transactions, and send transactions.
BlockchainAPIs
39Venly NFT Venly NFT enables users to build their own NFT (non-fungible token) marketplaces. 

The Venly NFT API offers access to the service, with methods to manage contracts, templates, minting NFTs, and retrieving NFTs, plus analytics by address, contracts or other information.
CryptoAPIs
40OpenSeaOpenSea is an non-fungible tokens (NFT or ERC721-based items) marketplace. Users can set up a wallet, create an NFT collection, list them for sale, and buy them with OpenSea. 

The OpenSea API offers ERC721 asset fetching and management. Methods are available to manage asset object, events, account objects, OpenSea listings, and more.
CryptoAPIs
41CryptingUpCryptocurrency ranking by trading volume, market data and charts. Research financial data for Bitcoin, Ethereum and other altcoins.

You can use our API to access CryptingUp API endpoints, which can get information on assets, markets, and exchanges in our database.
 
CryptoAPIs
42CurrencyAPICurrencyAPI - A simple, reliable and real-time currency exchange API for current and historical forex rates. Get real-time accurate rates on over 152 currencies, cryptocurrencies and precious metals. Rates are updated every 60 seconds.CryptoAPIs
43PeazePeaze is one API to connect to millions of cryptocurrency accounts. Use the API for account balances, transactions and other data, to place orders, to receive payments and more. 

It is useful for applications for wealth management, lending, personal finances, and consumer transactions.
CryptoAPIs
44DexDaqThe DexDaq API integrates crypto transactions data with a hybrid and decentralized exchange platform. 

Developers can authenticate with an API Key and make calls that return JSON responses with ticker, exchange information, currencies, trades, sell orders, and buy orders.
CryptoAPIs
45FIO ProtocolThe FIO (Foundation for Interwallet Operability) API allows developers to access blockchain information such as transactions, blocks, fee ratios, Tokens, and addresses. 

The API features REST architecture, JSON payload requests, and JSON responses. FIO Protocol is a consortium of leading wallets, exchanges, and crypto payment processors. This protocol is a decentralized service that removes the risk of sending and receiving coins and Tokens across every blockchain.
BlockchainAPIs
46BitLaunchThe BitLaunch API provides access to; details about a transaction, data revolving around a server, the ability to list all SSH keys for an account and more. 

This API requires that you generate an access Token to authenticate services for; Account, SSH Keys, Creation Options, Transactions and Servers. BitLaunch.io provides anonymous VPS services and accepts cryptocurrency as payment, from hosts that includes; DigitalOcean, Vultr and Linode.
CryptoAPIs
47KeycardKeycard provides a hardware implementation of a BIP-32 HD wallet that supports key generation, derivation and signing. It allows you to export keys defined in the context of EIP-1581. 

This API integration of Keycard is crypto wallets and can be used with other systems.
CryptoAPIs
48Celer NetworkCeler enables generalized off-chain smart contracts and transactions. This allows a 20,000-fold reduction in transaction latency, no transaction fees, and incentive-aligned cryptoeconomics. 

The Celer interface is used to integrate layer-2 scaling and on/off-chain smart contracts with applications. Celer is designed to be blockchain-agnostic and flexible; this allows for quick integrations with layer-1 blockchains.
BlockchainAPIs
49Zilliqa APIThe Zilliqa API enables developers to integrate blockchain related methods with their applications. Blockchain, transaction, contract and account methods are supported. 

Zilliqa is a high-performance, high-security blockchain designed for enterprise applications. Zilliqa enables real-world usability across different industries including digital advertising, gaming, and finance.
BlockchainAPIs
50ThreeFoldThreeFold leverages blockchain to build storage and compute applications such as IoT, Machine Learning, and Artificial Intelligence. 

ThreeFold features globally distributed nodes, autonomous deployment technology, and a peer-to-peer layer for frontend applications. The ThreeFold Token is a decentralized digital currency that represents a unit of reservation of capacity for computing and storing data.
BlockchainAPIs
51MoonDEXThe MoonDEX API enables developers to integrate cryptocurrency market data and order support with their applications. The API returns order books for a given market, coin summaries, and market histories. 

Additionally, the API is used to place limit orders for specific cryptocurrencies. The MoonDEX API implements API Key authentication.
CryptoAPIs
52HorizenHorizen is an inclusive ecosystem for decentralized applications. Horizen's ZEN is a cryptocurrency with full end-to-end encryption. 

Horizen offers an optional privacy feature that allows the control of digital footprints. Horizen is equipped with zk-SNARK privacy technology and a decentralized multi-tiered node architecture.
BlockchainAPIs
53ChaingatewayChaingateway.io offers a variety of API functions that make it easier to work with ERC20 tokens and Ethereum. No matter if the goal is to use an own ERC20 token or Ethereum as a payment method in an online shop, create an exchange, provide a wallet function to users, send tokens to millions of airdrop participants or building a bridge between a website currency and an ERC20 token. 

Chaingateway.io has you covered with all needed functions. There are functions to send any ERC20 token, send Ethereum, rent and control Ethereum addresses, receive any ERC20 token via webhook/Instant Payment Notification, check ERC20 token balances, check Ethereum balances, get info on transactions and more. It can be used with any programming language that can send JSON encoded HTTP POST requests, which should be easy for every developer.
CryptoAPIs
54NOWPaymentsNOWPayments is a non-custodial cryptocurrency payment processing platform. Accept payments in a wide range of cryptos and get them instantly converted into a coin of your choice and sent to your wallet. Keeping it simple – no excess. 

NOWPayments' API allows you to integrate crypto payments in 50+ assets into any service.
CryptoAPIs
55ZaboAn API for connecting any cryptocurrency account - both exchanges and wallets. Allows apps to easily collect balances and transaction histories from any crypto account.CryptoAPIs
56CurrencyFreaksFree Currency Conversion and Forex Exchange Rate API CurrencyFreaks API provides currency conversion, current and historical forex exchange rate, currency fluctuation, and IP to currency data through REST API in JSON and XML formats compatible.CryptoAPIs
57NiceHashNiceHash Miner is Bitcoin mining software. The NiceHash REST API provides programmatic access for the NiceHash test and production platform. 

API methods are available for accounting functions such as deposits, transactions, withdrawals, for external mining functions, for private and public orders details, for pools, and for private and public exchange details.
CryptoAPIs
58AmberdataAmberdata.io provides real-time, raw & augmented blockchain data. The Amerdata API enables developers to retrieve data about cryptocurrency markets and data, including tools to manage futures market data, spot market data, market metrics, blockchains, plus blockchain addresses, blocks, contacts, transactions and more.CryptoAPIs
59BitCombineBitCombine API offers cryptocurrency trading, real-time data collection, and exchange account management services. 

The API supports 3500 cryptocurrencies from 40 exchanges and more than 18,600 currency pairs. Methods are available to get balances, exchanges, order books, symbols and tickers, and to manage cancellations, orders, and withdrawals.
CryptoAPIs
60CopperThe Copper REST API provides access to account management and trading services that integrate into applications. 

The Copper platform integrates custody architecture for trading that gives institutional investors the ability to offer digital assets. It is a digital asset ecosystem focused on institutional custody and acquisition with a next-gen digital asset infrastructure for the financial services industry.
CryptoAPIs
61CryptoMeterThe CryptoMeter API returns cryptocurrency data including market, ticker, 24hr trading volume, hourly merged volume, and technical indicators. 

CryptoMeter invites developers to build a strategy and bots with their data. 
CryptoAPIs
62DeCurretDeCurret enables developers to integrates cryptocurrency exchange capabilities with their applications. Several cryptocurrencies are supported including Bitcoin and Ethereum. 

DeCurret adheres to strict system risk assessment standards, implements individual cold wallets for customers' cryptocurrency, and uses multisig for secure cryptocurrency storage. The API features REST architecture.
CryptoAPIs
630xThe 0x API provides methods to source liquidity from 0x Mesh, Kyber, Uniswap, Oasis, and decentralized exchange networks. With the API, developers can route transactions across decentralized exchange networks to find the lowest slippage possible. 

0x API automatically creates an order that can be passed directly to smart contracts to be settled on-chain. No API key is required. 0x offers liquidity, fast response times and low revert rates, flexible integration, and open-source terms.
BlockchainAPIs
64CircleCircle enables businesses to harness the power of stablecoins. Stablecoins offer the flexibility and security of cryptocurrencies, and the low volatility of government issued currencies. Circle is powered by USD Coin (USDC). 

The Circle API integrates global banking connectivity, and wallet infrastructure with external fintech applications.
CryptoAPIs
65SmartHoldemThe SmartHoldem API returns blockchain data including accounts, blocks, transactions, peers, and transports. 

SmartHoldem Platform features trading, DEX games, top 64 decentralized nodes, game engine, staking program, and DAPPs and sidechains.
BlockchainAPIs
66YoBit TradeThe YoBit Public API allows developers to get information that doesn't require access to personal account data, such as the depth, fee, ticker, and trades for a given currency pair. YoBit is a cryptocurrency exchange platform.CryptoAPIs
67ParaSwapThe ParaSwap API allows applications and traders to access liquidity, price feeds, instant swaps, and payments. The API operates as a decentralized exchange hub, obtaining the nest price to building a transaction payload.CryptoAPIs
68CoinpushThe Coinpush API enables users to accept cryptocurrency payments. 

Coinpush provides a free API that's easy to get started with. It enables the integration of: Bitcoin, Bitcoin Cash and Litecoin payments into your businesses or web applications.
CryptoAPIs
69ZB The ZB REST API allows developers to integrate ZB's cryptocurrency trading functions into their applications. This API is primarily recommended for currency transactions and asset withdrawals. However, it can also get information on the market configuration, market depth, ticker data, historical deals, K-line, etc. ZB is a Chinese cryptocurrency exchange. 

Their website is provided in both English and Chinese, but the API documentation is provided only in Chinese.
The Bithumb Public API allows developers to use REST calls to access cryptocurrency exchange market information. This includes current price information, bid and ask information, transaction history, and the Bithumb Crypto Index (BTCI). 
CryptoAPIs
70AirSwapAirSwap Server can be used to set and get intents locally, approve Tokens for trading, submit orders, and more blockchain-related functionalities. 

The API features REST architecture, and JSON responses. AirSwap offers decentralized peer-to-peer Token transactions build upon the Ethereum blockchain.
CryptoAPIs
71TokenAnalystThe TokenAnalyst API allows developers to get basic transaction data and aggregated on-chain statistics derived directly from the blockchain. 

Developers can access fundamentals for Bitcoin, Ethereum, and ERC20. They can also access exchange flows for Bitcoin, Ethereum, Stablecoin, and ERC20. Prices for all supported assets are available in USD.
CryptoAPIs
72CoinMetricsThe CoinMetrics API returns cryptocurrency data in JSON format for analytics and research. 

With the API, developers can implement assets, exchanges, markets, metrics, and indexes in addition to trades, values, and quotes. CoinMetrics provides cryptocurrency asset market and network data.
CryptoAPIs
73CoinTrackingThe CoinTracker API returns cryptocurrency reporting and tracking data in JSON format. Developers can use an API Key with a secret to POST data that displays trades, balances, historical currencies, and gains.CryptoAPIs
74CoinDaddyThe CoinDaddy Counterparty REST API provides access to Counterparty, which is used to embed data into Bitcoin transactions. Counterparty can be used to create and trade any kind of digital token and to write Smart Contracts and execute them on the Bitcoin blockchain. 

This API is still under development and will include more features in the future. This API is provided by CoinDaddy, a crypto 2.0 service company that focuses on making blockchain technologies more accessible.
CryptoAPIs
75ChangellyThe Changelly API allows developers to integrate features from the Changelly cryptocurrency exchange into their own services and applications. 

The API can be used to get a list of currencies available for exchange, get the minimum exchangeable amount for a currency pair, get an estimate of coins received as the result of a given exchange, create a transaction, and more. If the API methods provided by default are insufficient, developers can contact the Changelly developer team to request more features.
CryptoAPIs
76Minter NodeMinter is a blockchain network that enables the creation of coins with absolute and instant liquidity. Coins can be exchanged within and outside the network. 

The Minter Node API allows developers to access transactions, blocks, events, and validators. JSON is the preferred response format.
CryptoAPIs
77ParadigmParadigm is a multidimensional crypto data API, research and analytics platform. 

The unified API provides single endpoint access to datasets, curated content and visual analytics all at the same time. Paradigm harmonizes the data so you don’t have to and provides detailed meta data analytics on how different providers serve data for the same crypto assets.
CryptoAPIs
78WhaleclubThe Whaleclub API provides RESTful access to a bitcoin and altcoin trading platform. Developers can use the API to submit new trades, check their balance, get their trade history, and more. 

This API works with both live and demo accounts. All requests, responses, and errors are encoded in JSON.
CryptoAPIs
79TickeronTickeron offers summaries and technical analysis data for any stock, ETF, and cryptocurrency. This information is provided via RSS feed. Tickeron is a financial marketplace powered by artificial intelligence.CryptoAPIs
80Request NetworkThe Request Network API is a RESTful service that enables users to interact with the Request Protocol, abstracting all Blockchain-related aspects. Use the API to create Requests, list Requests, and find a specific Request by its ID. 

The Request service uses an API Key to authenticate requests, and supports JSON-encoded requests and responses. Request Network is an Open Financial Network for transaction requests that includes support for; blockchain, invoicing, ethereum and more. 

This API is currently in alpha, and is running on the Rinkeby Ethereum test network. Please check the Request Network roadmap to learn more about the Protocol release to the Ethereum Mainnet.‌‌
Blockchain APIs
81BitflyThe Bitfly API provides cryptocurrency Ethereum mining pool data. Developers can make 100 requests every 15 minutes. Endpoints are CORS.CryptoAPIs
82Slush PoolThe Braiins Slush Pool API provides data in JSON for cryptocurrency mining stats, profiles and workers. Slush Pool is a Bitcoin Mining pool that is AsicBoost compatible.CryptoAPIs
83BlockCypherThe BlockCypher Webhooks API allows you to leverage objects and interactions in BlockCypher payments services. 

This includes notifications for new transaction BlockCypher receives, every new block added, every new transactions and more. BlockCypher provides infrastructure and support services to build applications and web services for blockchain applications.
BlockchainAPIs
84ZebpayThe Zebpay API provides a way to access and integrate trading, wallet, blockchain, and market analysis functionality, that allows you to create crypto applications, tools, bots and more. 

The Zebpay Build platform enables users with the ability to create cryptocurrency trading applications.
CryptoAPIs
85HaasOnlineHaasOnline Software offers the means to control cryptocurrency trades. This platform features automated 24/7 trading bots, historical and real time back testing, and support for over a dozen cryptocurrency exchanges. 

The API offers several endpoints for market, account, and trade data. Responses are JSON or XML formatted.
CryptoAPIs
86Heat WalletThe Heat Wallet API returns crypto wallet data including trades, mining, exchange, transactions, blockchain, accounts, and peers. The interactive REST API supports JSON data and it provides a Swagger URL.CryptoAPIs
87SeedCXThe SeedCX API returns market data, initial margins, currencies, and collateralization through their public endpoints. Orders and accounts are available via private endpoints. SeedCX uses HMAC SHA-256 verification with API Keys to make calls that display JSON in return. 

Seed CX is a regulated, institutional exchange and settlement platform for digital assets.
CryptoAPIs
88hybrixhybrix provides an Open Source Multi Ledger API to build multi-blockchain and multi-ledger solutions. It is used to retrieve information from hybrix that includes; balances, transaction history, address validation and more. 

Responses support JSON format for a balance of the Bitcoin address, the progress, result of process etc. hybrix is a distributed platform environment to network and manage digital forms of value transfer.
CryptoAPIs
89DecentralandThis API allows you to GET Decentraland LAND data for Contributions, Districts, Estates, Mortgages and more. Decentraland uses the Ethereum blockchain to record the ownership of the digital assets, and other tradable items that can be read and reacted to by a 3D scene. 

Tokens that are used for experiences and games in Decentraland are held in an Ethereum wallet that holds various tokens for Ether, MANA, LAND, and others. Decentraland is a decentralized VR platform service that is powered by the Ethereum blockchain, that allows you to create, experience, and monetize content and applications.
CryptoAPIs
90ShrimpyShrimpy provides a platform for cryptocurrency trading, portfolio allocation, and real-time data collection. Shrimpy supports KuCoin, Binance, Kraken, and more. 

The REST API offers access to accounts, users, trading assets, and analytics. JSON is the preferred response format. Shrimpy’s Universal Crypto Exchange APIs are the only unified APIs for crypto exchanges that are specifically designed for application developers. 

Collect real-time trade or order book data for free, manage user exchange accounts, execute trading strategies, and simplify the way you connect to each exchange.
CryptoAPIs
91DaneelDaneel is a blockchain news curation API that developers can use to return the sentiment for a cryptocurrency. 

The sentiment is calculated by analyzing different sources of information including Twitter, Reddit, Bitcoin talk, News and Facebook (coming soon). API methods are available to retrieve market news, score, price, sentiment, and trends.
BlockchainAPIs
92CoinpaprikaThe Coinpaprika API returns current crypto market data for coin prices, volumes, market caps, ATHs, return rates and more. All endpoints return either a JSON object or array. 

Coinpaprika provides a research platform that allows you to access Market Overview, Prices, Charts, Teams, Events, Github, Twitter, ATH, Reddit and Coin Details.
CryptoAPIs
93DfuseThe dfuse API returns JSON formats to build EOS blockchain crypto applications. Developers can get a free API Key to work with REST and WebSockets.BlockchainAPIs
94CryptowatchThe Cryptowatch Market Data REST API returns crypto information including assets, pairs, exchanges, and markets. Currencies include Bitcoin, Monero, Zcash, Ethereum, Dash, EOS, Ripple, Litecoin, Stellar, True, Waves, and more. 

Developers used Go to write Cryptowatch, that uses Redis and PostgreSQL to store data and React.js to build the frontend. The API is based on Mozilla Canvas API.
CryptoAPIs
95Totle Smart Contract APIThe Totle Smart Contract API is available using the GraphQL query service. This allows developers to pull an array of token data from the Totle global network. 

It provides access to DEX data and allows you to compare token prices and route orders across global decentralized exchanges. Totle is a cryptocurrency portfolio management tool and decentralized exchange aggregator.
CryptoAPIs
96ChainRiderThe ChainRider Webhooks API delivers notifications containing events such as new transactions, new blocks, confirmation of transactions, and changing of address balance. ChainRider is a cloud based management platform for Bitcoin and Dash blockchains. ChainRider offers a microservice with 99.995% availability and automatic scaling for a high number of simultaneous API requests. This API uses JSON for responses.CryptoAPIs
97CoinloreThe Coinlore Crypto API provides cryptocurrency ticker information. Developers can retrieve data such as crypto name (ie Bitcoin) ID, symbol, us dollar price, rank, market cap, and more. Coinlore is a provider of Cryptocurrency Prices Ranking, Charts, API, Widgets and much more.CryptoAPIs
98CosmosCosmos offers an integrated cryptocurrency platform with wallet, dashboard, and miner. Any blockchain system can be incorporated into the Cosmos hub directly, without intermediaries. 

The Cosmos platform uses Byzantine fault tolerance (BFT) theory to tolerate machines failing in arbitrary ways. Additionally, Cosmos uses Tendermint for securely and consistently replicating an application on many machines.
BlockchainAPIs
99CoinCapThe CoinCap API provides real-time pricing and market activity for over 1,000 cryptocurrencies. It collects exchange data from thousands of markets for transparent and accurate data on asset price and availability. 

The API offers insights into which exchanges and markets contribute to CoinCap pricing and includes services for Assets, Rates, Exchanges and more. 

The CoinCap 2.0 RESTful API is currently in beta and will soon be fully functioning. CoinCap.io is real time market data resources for digital assets.
CryptoAPIs
100ZloadrThe Zloadr Professional API offers information related to legal structures of crypto assets, longevity of assets, and performance of crypto assets. This data is offered in JSON format. 

The API provides methods for cryptocurrency historical data, latest market quotes for one or more cryptocurrencies, listing market pairs, and more. Developers can test drive the API with a limited plan (with a limited number of daily/monthly calls).
CryptoAPIs
101CoinlayerThe coinlayer REST API was built to deliver on-demand real-time or historical cryptocurrency exchange rates in JSON format. Crypto data is sourced from more than 25 worldwide exchanges, features more than 385 coins and can be accessed using any programming language, framework and device. 

The API is free for a limited amount of monthly API requests and can be used at premium level to gain access to features like 60-second updates, conversion and time-series endpoints, and much more.
CryptoAPIs
102HydrogenThe Hydro API enables applications to interface with Hydro’s smart contracts. All Hydrogen APIs are built on REST principles, with resource-oriented URLs and HTTP response codes. All API responses are returned in JSON format. BlockchainAPIs
103StrikeThe Strike API in REST architecture returns bitcoin and cryptocurrency data. Developers can use basic auth, API Key, and HTTP verbs that display JSON objects in return.CryptoAPIs
104Moon BankingThe Moon Banking API is a ranking service for crypto friendly banks. Users obtain and fund quota for this production API through Bitcoin payments on the Lightning Network mainnet. Moon Banking provides a way to view crypto friendly banks stories and rankings.CryptoAPIs
105CoinTreeCoinTree is an Australian Bitcoin exchange marketplace. The CoinTree API supports the integration of CoinTree’s Bitcoin trading functions in applications.CryptoAPIs
106AuroraAurora operates a decentralized cryptobanking and financial platform. The IDEX API allows you to develop applications that support the implementation of Aurora trading platform. The API conveys requests and responses in JSON format.CryptoAPIs
107Waves PlatformWaves Platform is a provider of blockchain solutions for building trading platforms. The Waves Node API provides RESTful platform for implementing blockchain functionality in trading apps. Use the API to integrate a variety of functionalities including orders, transaction history, and balances.BlockchainAPIs
108Cex.ioCex.io is a cryptocurrency exchange platform. Integration of the Cex.io WebSocket API allows you to access real time notifications without sending extra requests. This expedites data transmission from the exchange.BlockchainAPIs
109CoingiThe Coingi Exchange allows you to integrate Coingi.com’s trading functions in your apps. The RESTful API provides endpoint for both public and private functions. It returns responses in JSON format.CryptoAPIs
110FlowBTCflowBTC is a Brazilian digital trading platform. The flowBTC API supports the integration of cryptocurrency trading functionality in applications. The API provides both Private and Public endpoints.CryptoAPIs
111ChangeNOWThe ChangeNOW Exchanger API allows applications to be integrated with cryptocurrency exchange services. Developers can easily integrate the system of cryptocurrency exchange with the API. 

ChangeNOW API has detailed technical documentation. It operates with HTTPS protocol and provides a number of methods for the queries to be placed and the responses to be returned for each operation. All the responses are delivered through JSON API format. ChangeNOW is a web platform created for the simple exchange of any cryptocurrency. To avoid identification and financial theft, users don’t need to register or leave personal information.
CryptoAPIs
112LiveCoinLiveCoin provides a simple interface, low-fee trading platform for accessing cryptocurrency trading markets. Use the LiveCoin Exchange API to integrate cryptocurrency and fiat money trading functionalities. It provides a variety of trading tools and supports bots trading and arbitrage. The RESTful API returns JSON-formatted responses.CryptoAPIs
113LykkeLykke is a Swiss provider of cryptocurrency trading solutions. The Lykke Trading API is used to access trading history, updated asset pairs, orders, and wallets. The API offers complete support for margin trading. JSON data is the preferred format for responses.CryptoAPIs
114CoinExCoinEx is a global digital coin exchange. The CoinEx API allows you to integrate cryptocurrency trading tools in your apps. It is a RESTful platform that conveys requests and responses in JSON format.CryptoAPIs
115PaymiumPaymium is a European Exchange market for digital assets. The Paymium API allows developers to extend the capabilities of the Paymium platform, from reading the latest ticker to automating trades with bots. The API returns responses in JSON format.CryptoAPIs
116Kuna ExchangeKuna Exchange is a Ukrainian cryptocurrency marketplace for Eastern Europe. Use the Kuna Exchange API to build applications that connect to the Kuna cryptocurrency trading platform.CryptoAPIs
117SouthXchangeSouthXchange is a currency management platform built and operated by PRO-Systems. The SouthXchange to integrate cryptocurrency trading functions for Bitcoin and other digital assets. The API returns JSON-formatted responses.CryptoAPIs
118Liqui ExchangeLiqui Exchange is a Ukraine-based cryptocurrency trading platform. The Liqui Exchange API allows you to build apps that connect to the cryptocurrency marketplace. Use the RESTful API to provide accessibility to trading functions such as tickers of currency pairs, active orders on different pairs, and latest trades of each pairs, among others.CryptoAPIs
119CoincheckCoincheck is Japan's largest Bitcoin exchange. The platform supports purchase payments, sales receipts, and lending transactions. The Coincheck Exchange API provides access to both public API and private API endpoints. 

Whereas the public API is useful for browsing order status and ordering books, the private API supports the creation and the canceling of new orders as well as the confirmation of account balance.
CryptoAPIs
120BitbayBitbay is a European trading platform for Bitcoin and digital currency. The Bitbay Private API provides API key-authenticated access to Bitbay’s currency trading functions. Establish a connection with the API by sending a POST request to its endpoint. Each request must have a method parameter.CryptoAPIs
121BiboxBibox is a Chinese digital asset exchange marketplace. The Bibox API provides a RESTful Access to the Bibox trading platform. The API conveys requests in URI Query String/CRUD format.CryptoAPIs
122CoinoneCoinone is South-Korea based cryptocurrency exchange platform. Use the Coinone API to integrate trading functionality for Bitcoin and Ethereum crypto currencies. The API supports JSON responses.CryptoAPIs
123NexchangeThe Nexchange API provides crypto currency exchange that includes Get Currencies, Get Pairs, Latest Ticker, Ticker History and more. NexchangeIO is a secure open source crypto to crypto exchange service for BTC - Bitcoin, LTC - Litecoin and ETH - Ethereum.CryptoAPIs
124ICO WatchThe ICO Watch List API in REST architecture offers a list of live, upcoming, and past initial coin offering (ICO) projects in the cryptocurrency space. Developers can access data generated by the ICO Watch List platform updated in real time.CryptoAPIs
125PolygonThe Polygon API returns JSON responses to get companies, trades, historic quotes, currencies, forex ticks, and currency trades data. Polygon streams stocks and market data in real-time.BlockchainAPIs
126KorbitThe Korbit is a South Korea-based Bitcoin exchange platform. The Korbit API allows developers to integrate the functionality for authenticating users, viewing filled and open order, complete KRW or BTC transfers, and capture all user transactions.CryptoAPIs
127MultiChainThe MultiChain API boasts "feeling at home" if you’re familiar with bitcoin. The API has maximal compatibility with Bitcoin Core, the reference client for the bitcoin network. As a fork of Bitcoin Core, MultiChain shares the following technical characteristics: Command-line arguments, Network protocol, JSON-RPC API, Transaction format, Script language, and Block format. 

The robust documentation offers basics of working with MultiChain such as: "How to create or connect to a blockchain", "Customizing your blockchain parameters and API commands for controlling MultiChain", as well as information about compatibility with Bitcoin Core.
BlockchainAPIs
128KaikoKaiko offers a suite of Bitcoin Price API with Global, USD, EUR and CNY indexes. Information is based on the prices of major exchanges and weighted by both volume and liquidity. Developers can price Bitcoin according to index data. API available via REST, websocket, and widgets. The price index can be consumed for free on Mashape Marketplace.CryptoAPIs
129BitbondBitbond is a Bitcoin lending system. This system works as an intermediary between Bitcoin investors and borrowers. The nature of cryptocurrencies allows for a global loan market. 

The Bitbond API is used to gain access to this peer-to-peer network, create an investment client, and obtain historical data about loans and borrowers. This API returns data in JSON format, and uses OAuth 2 for authentication.
CryptoAPIs
130CoinhillsCoinhills is a cryptocurrency and stock market index platform. It features a fully customizable dashboard, portfolio manager, and cryptocurrency news reader. Currency pairs are available as well. The CSPA (Coinhills Spot Price Average) Index API provides price data based on Coinhills' registered markets. This API returns data in JSON, and JSONP formats.CryptoAPIs
131CoinmapThe coinmap REST API allows developers to programmatically access a map of locations where popular cryptocurrencies - including Bitcoin, Litecoin, and Peercoin - are accepted. 

The data provided by this API is licensed under the Open Data Commons Open Database License (ODbL). Users are free to make use of the data as long as they credit coinmap and its contributors. Any projects or applications built with this data may only be distributed under the same license.
CryptoAPIs
132BlockonomicsThe Blockonomics API allows users to programmatically monitor transactions and balances for all of their public bitcoin addresses. These addresses can be labelled to help identify transactions. 

The API can also be used to add or update addresses to be monitored in Wallet Watcher. Blockonomics users can view graphs of past activity on their addresses and receive email notifications for transactions.
CryptoAPIs
133BlockCypherThe BlockCypher API allows to embed assets across blockchains. Protocols in JSON, REST, and HTTP. Endpoints available to generate asset address, issue asset, transfer asset, and list asset. BlockCypher is a block chain platform for powering cryptocurrency applications. Currently, BlockCypher supports Bitcoin, Bitcoin Testnet3, Litecoin, Dogecoin, and BlockCypher's Test Chain.CryptoAPIs
134ShapeShiftShapeShift is a digital currency exchange app. The API uses GET and POST requests over HTTPS with JSON to convert from one cryptocurrency to another and to take payment in Bitcoin (Overstock uses it for this purpose). Use ShapeShift to complete a transaction, request an email receipt, see a list of recent transactions, or return a list of supported coins.CryptoAPIs
135Vaultoro TradingThe Vaultoro Trading API allows developers to build third-party applications that allow their users to view their bitcoin and gold account balance, and to open buy or sell orders. This API also allows app end users to issue a buyorder or a sellorder, cancel a buyorder or a sellorder, and more. Vaultoro is a bitcoin gold exchange company.CryptoAPIs
136BitcoreMaintained by BitPay, Bitcore is an open source Node.js library for creating cross platform Bitcoin-enabled applications with a secure payment protocol and private key management. The Bitcore API allows a method of Bitcoin integration using JavaScript. The API specifically enables an app to access private or public keys, perform peer-to-peer cryptocurrency transactions, manage networks, handle and convert Bitcoin, and more.CryptoAPIs
137CoinprismCoinprism is a service that allows for the tokenization of cryptocurrency. Using Coinprism's Colored Coins, users are able to trade shares, bonds, and commodities without regulation by coloring BitCoin. Using the Coinprism Colored Coins API, developers can use GET & POST HTTP requests to issue colored coins, access a wallet to make a transaction, and return balances.CryptoAPIs
138BitcoinAverageBitcoinAverage is a cryptocurrency data service provider with the longest running Bitcoin price index since 2013. We integrate data from over 60 exchanges and 500+ Cryptocurrencies and tokens and provide it via one single API. CryptoAPIs
139RippleRipple was created to provide a free, open-source, payment service that exist without a central authority. It is open-source, almost free to use, an can pay out in an currency. The Ripple API allows users to integrate the Ripple payment system and platform into third-party projects.BlockchainAPIs

Conclusion

Before choosing the best crypto API, examine the documentation to understand what data is accessible, any rate-limiting difficulties, and your anticipated data consumption pricing. Some of these APIs include language-specific libraries that are officially supported to assist developers in getting started quickly.

Read more: How to Earn with Crypto Exchange Affiliate Programs

I hope this article will help you. Don't forget to leave a like, comment and sharing it with others. Thank you!

#blockchain #bitcoin #cryptocurrency #api #apis 

Cryptocurrency APIs: Top 200 APIs for Developer and Traders

Hug: Make Developing Python Driven APIs As Simple As Possible

hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a result, it drastically simplifies Python API development.

hug's Design Objectives:

  • Make developing a Python driven API as succinct as a written definition.
  • The framework should encourage code that self-documents.
  • It should be fast. A developer should never feel the need to look somewhere else for performance reasons.
  • Writing tests for APIs written on-top of hug should be easy and intuitive.
  • Magic done once, in an API framework, is better than pushing the problem set to the user of the API framework.
  • Be the basis for next generation Python APIs, embracing the latest technology.

As a result of these goals, hug is Python 3+ only and built upon Falcon's high performance HTTP library

HUG Hello World Example

Supporting hug development

Get professionally supported hug with the Tidelift Subscription

Professional support for hug is available as part of the Tidelift Subscription. Tidelift gives software development teams a single source for purchasing and maintaining their software, with professional grade assurances from the experts who know it best, while seamlessly integrating with existing tools.

Installing hug

Installing hug is as simple as:

pip3 install hug --upgrade

Ideally, within a virtual environment.

Getting Started

Build an example API with a simple endpoint in just a few lines.

# filename: happy_birthday.py
"""A basic (single function) API written using hug"""
import hug


@hug.get('/happy_birthday')
def happy_birthday(name, age:hug.types.number=1):
    """Says happy birthday to a user"""
    return "Happy {age} Birthday {name}!".format(**locals())

To run, from the command line type:

hug -f happy_birthday.py

You can access the example in your browser at: localhost:8000/happy_birthday?name=hug&age=1. Then check out the documentation for your API at localhost:8000/documentation

Parameters can also be encoded in the URL (check out happy_birthday.py for the whole example).

@hug.get('/greet/{event}')
def greet(event: str):
    """Greets appropriately (from http://blog.ketchum.com/how-to-write-10-common-holiday-greetings/)  """
    greetings = "Happy"
    if event == "Christmas":
        greetings = "Merry"
    if event == "Kwanzaa":
        greetings = "Joyous"
    if event == "wishes":
        greetings = "Warm"

    return "{greetings} {event}!".format(**locals())

Which, once you are running the server as above, you can use this way:

curl http://localhost:8000/greet/wishes
"Warm wishes!"

Versioning with hug

# filename: versioning_example.py
"""A simple example of a hug API call with versioning"""
import hug

@hug.get('/echo', versions=1)
def echo(text):
    return text


@hug.get('/echo', versions=range(2, 5))
def echo(text):
    return "Echo: {text}".format(**locals())

To run the example:

hug -f versioning_example.py

Then you can access the example from localhost:8000/v1/echo?text=Hi / localhost:8000/v2/echo?text=Hi Or access the documentation for your API from localhost:8000

Note: versioning in hug automatically supports both the version header as well as direct URL based specification.

Testing hug APIs

hug's http method decorators don't modify your original functions. This makes testing hug APIs as simple as testing any other Python functions. Additionally, this means interacting with your API functions in other Python code is as straight forward as calling Python only API functions. hug makes it easy to test the full Python stack of your API by using the hug.test module:

import hug
import happy_birthday

hug.test.get(happy_birthday, 'happy_birthday', {'name': 'Timothy', 'age': 25}) # Returns a Response object

You can use this Response object for test assertions (check out test_happy_birthday.py ):

def tests_happy_birthday():
    response = hug.test.get(happy_birthday, 'happy_birthday', {'name': 'Timothy', 'age': 25})
    assert response.status == HTTP_200
    assert response.data is not None

Running hug with other WSGI based servers

hug exposes a __hug_wsgi__ magic method on every API module automatically. Running your hug based API on any standard wsgi server should be as simple as pointing it to module_name: __hug_wsgi__.

For Example:

uwsgi --http 0.0.0.0:8000 --wsgi-file examples/hello_world.py --callable __hug_wsgi__

To run the hello world hug example API.

Building Blocks of a hug API

When building an API using the hug framework you'll use the following concepts:

METHOD Decorators get, post, update, etc HTTP method decorators that expose your Python function as an API while keeping your Python method unchanged

@hug.get() # <- Is the hug METHOD decorator
def hello_world():
    return "Hello"

hug uses the structure of the function you decorate to automatically generate documentation for users of your API. hug always passes a request, response, and api_version variable to your function if they are defined params in your function definition.

Type Annotations functions that optionally are attached to your methods arguments to specify how the argument is validated and converted into a Python type

@hug.get()
def math(number_1:int, number_2:int): #The :int after both arguments is the Type Annotation
    return number_1 + number_2

Type annotations also feed into hug's automatic documentation generation to let users of your API know what data to supply.

Directives functions that get executed with the request / response data based on being requested as an argument in your api_function. These apply as input parameters only, and can not be applied currently as output formats or transformations.

@hug.get()
def test_time(hug_timer):
    return {'time_taken': float(hug_timer)}

Directives may be accessed via an argument with a hug_ prefix, or by using Python 3 type annotations. The latter is the more modern approach, and is recommended. Directives declared in a module can be accessed by using their fully qualified name as the type annotation (ex: module.directive_name).

Aside from the obvious input transformation use case, directives can be used to pipe data into your API functions, even if they are not present in the request query string, POST body, etc. For an example of how to use directives in this way, see the authentication example in the examples folder.

Adding your own directives is straight forward:

@hug.directive()
def square(value=1, **kwargs):
    '''Returns passed in parameter multiplied by itself'''
    return value * value

@hug.get()
@hug.local()
def tester(value: square=10):
    return value

tester() == 100

For completeness, here is an example of accessing the directive via the magic name approach:

@hug.directive()
def multiply(value=1, **kwargs):
    '''Returns passed in parameter multiplied by itself'''
    return value * value

@hug.get()
@hug.local()
def tester(hug_multiply=10):
    return hug_multiply

tester() == 100

Output Formatters a function that takes the output of your API function and formats it for transport to the user of the API.

@hug.default_output_format()
def my_output_formatter(data):
    return "STRING:{0}".format(data)

@hug.get(output=hug.output_format.json)
def hello():
    return {'hello': 'world'}

as shown, you can easily change the output format for both an entire API as well as an individual API call

Input Formatters a function that takes the body of data given from a user of your API and formats it for handling.

@hug.default_input_format("application/json")
def my_input_formatter(data):
    return ('Results', hug.input_format.json(data))

Input formatters are mapped based on the content_type of the request data, and only perform basic parsing. More detailed parsing should be done by the Type Annotations present on your api_function

Middleware functions that get called for every request a hug API processes

@hug.request_middleware()
def process_data(request, response):
    request.env['SERVER_NAME'] = 'changed'

@hug.response_middleware()
def process_data(request, response, resource):
    response.set_header('MyHeader', 'Value')

You can also easily add any Falcon style middleware using:

__hug__.http.add_middleware(MiddlewareObject())

Parameter mapping can be used to override inferred parameter names, eg. for reserved keywords:

import marshmallow.fields as fields
...

@hug.get('/foo', map_params={'from': 'from_date'})  # API call uses 'from'
def get_foo_by_date(from_date: fields.DateTime()):
    return find_foo(from_date)

Input formatters are mapped based on the content_type of the request data, and only perform basic parsing. More detailed parsing should be done by the Type Annotations present on your api_function

Splitting APIs over multiple files

hug enables you to organize large projects in any manner you see fit. You can import any module that contains hug decorated functions (request handling, directives, type handlers, etc) and extend your base API with that module.

For example:

something.py

import hug

@hug.get('/')
def say_hi():
    return 'hello from something'

Can be imported into the main API file:

__init__.py

import hug
from . import something

@hug.get('/')
def say_hi():
    return "Hi from root"

@hug.extend_api('/something')
def something_api():
    return [something]

Or alternatively - for cases like this - where only one module is being included per a URL route:

#alternatively
hug.API(__name__).extend(something, '/something')

Configuring hug 404

By default, hug returns an auto generated API spec when a user tries to access an endpoint that isn't defined. If you would not like to return this spec you can turn off 404 documentation:

From the command line application:

hug -nd -f {file} #nd flag tells hug not to generate documentation on 404

Additionally, you can easily create a custom 404 handler using the hug.not_found decorator:

@hug.not_found()
def not_found_handler():
    return "Not Found"

This decorator works in the same manner as the hug HTTP method decorators, and is even version aware:

@hug.not_found(versions=1)
def not_found_handler():
    return ""

@hug.not_found(versions=2)
def not_found_handler():
    return "Not Found"

Asyncio support

When using the get and cli method decorator on coroutines, hug will schedule the execution of the coroutine.

Using asyncio coroutine decorator

@hug.get()
@asyncio.coroutine
def hello_world():
    return "Hello"

Using Python 3.5 async keyword.

@hug.get()
async def hello_world():
    return "Hello"

NOTE: Hug is running on top Falcon which is not an asynchronous server. Even if using asyncio, requests will still be processed synchronously.

Using Docker

If you like to develop in Docker and keep your system clean, you can do that but you'll need to first install Docker Compose.

Once you've done that, you'll need to cd into the docker directory and run the web server (Gunicorn) specified in ./docker/gunicorn/Dockerfile, after which you can preview the output of your API in the browser on your host machine.

$ cd ./docker
# This will run Gunicorn on port 8000 of the Docker container.
$ docker-compose up gunicorn

# From the host machine, find your Dockers IP address.
# For Windows & Mac:
$ docker-machine ip default

# For Linux:
$ ifconfig docker0 | grep 'inet' | cut -d: -f2 | awk '{ print $1}' | head -n1

By default, the IP is 172.17.0.1. Assuming that's the IP you see, as well, you would then go to http://172.17.0.1:8000/ in your browser to view your API.

You can also log into a Docker container that you can consider your work space. This workspace has Python and Pip installed so you can use those tools within Docker. If you need to test the CLI interface, for example, you would use this.

$ docker-compose run workspace bash

On your Docker workspace container, the ./docker/templates directory on your host computer is mounted to /src in the Docker container. This is specified under services > app of ./docker/docker-compose.yml.

bash-4.3# cd /src
bash-4.3# tree
.
├── __init__.py
└── handlers
    ├── birthday.py
    └── hello.py

1 directory, 3 files

Security contact information

hug takes security and quality seriously. This focus is why we depend only on thoroughly tested components and utilize static analysis tools (such as bandit and safety) to verify the security of our code base. If you find or encounter any potential security issues, please let us know right away so we can resolve them.

To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.

Why hug?

HUG simply stands for Hopefully Useful Guide. This represents the project's goal to help guide developers into creating well written and intuitive APIs.


Thanks and I hope you find this hug helpful as you develop your next Python API!

~Timothy Crosley

Author: hugapi
Source Code: https://github.com/hugapi/hug
License: MIT License

#python #apis 

Hug: Make Developing Python Driven APIs As Simple As Possible
Jamie  Graham

Jamie Graham

1646928808

Graphql Apis: A Collective List Of Public GraphQL APIs

Public GraphQL APIs

A collective list of public GraphQL APIs. PRs are welcome :smile: If you are interested in GraphQL in general, check out awesome-graphql.

Official APIs

APIDescriptionGraphiQLDocs/Repo
AniListAnime and manga datum, including character, staff, and live airing data.Try it!Docs
Artsyfree online platform for collecting and discovering artTry it!Repo
Bitqueryon-chain blockchain analyticsTry it!Docs
BraintreePayment platformTry it!Docs
BuildkiteContinuous integration and deploymentsTry it!Docs
Catalysis HubChemical surface reaction energies and structuresTry it!Repo
Docs
CommerceToolse-commerce solutionsTry it!Docs
Contentful"CMS as a Service". GraphiQL demo allows to query a simple blog, but the library itself generates a schema automatically for any content model you store in Contentful.Try it!Docs
CountriesInformation about countries, continents, and languages, based on Countries ListTry it!Repo
Countries v2Country related data like currencies, languages, flags, regions+subregions, bordering countries, distance to other countries and much moreTry it!Repo
Deutsche BahnInfrastructure Data, like realtime facility status, stations, timetables and moreTry it!Repo
cTransit routes and realtime schedules from Helsinki Regional Transport Authority, FinlandTry it!Docs
EHRIHolocaust-related archival materialsTry it!Docs
EtMDBEthiopian Movie DatabaseTry it!Docs
EverbaseCountries, cities, exchange rates, geolocation and a lot more.Try it!Docs
FaunaDBServerless GraphQL DatabaseTry it!Docs
GdomDOM Traversing and Scraping using GraphQLTry it!Repo
GitHubWeb-based Git repository hosting serviceTry it!Docs
GitLabHost-your-own Git repository hosting serviceTry it!Docs
GraphLocFind a geolocation of an IP address including latitude, longitude, city, country, time zone and area code. Free to use, SSL supportedTry it!Docs
GraphQL JobsGraphQL jobs in modern startupsTry it!Docs
HIVDBA curated database to represent, store and analyze HIV drug resistance dataTry it!Docs
IdobataDedicated chat for team development.Try it! 
leanIXTools for business strategy Docs
PipefyThe operations excellence platform.Try it!Docs
MattermarkBusiness research and networking Docs
MemairQuantified self / extended mind platformTry it!Docs
melodyRepoFast and reliable dependency manager for GoTry it!Docs
React FinlandReact Finland API is built with conferences and meetups in mindTry it!Repo
Shopify StorefrontThe Storefront API gives you full creative control to build customized purchasing experiences for your customers.Try it!Docs
Examples
Shopify AdminThe Admin API is the primary way that apps and services interact with Shopify.Try it!Docs
SWOPGraphQL and REST foreign exchange rate API. Note: Required registration.Try it!Docs
UniverseCheck what your friends are doing & find unique events near you using our filter.Try it!Docs
YelpUser Reviews and Recommendations of Top Restaurants, Shopping, Nightlife, Entertainment, Services and MoreTry it!Docs
TravelgateXThe global marketplace for the travel tradeTry it!Docs

Unofficial API proxies

APIDescriptionGraphiQLDocs/Repo
Barcelona Urban Mobility APIInformation about the different public transport / urban mobility services of BarcelonaTry it!Repo
Câmara dos deputados Brasil"GraphQL api to grab the data from the brazilian deputies chamber"Try it!Repo
Ghibliql"GhibliQL is a GraphQL wrapper to the Studio Ghibli REST API"Try it!Repo
MetaMateSemantic service bus example for HackerNewsTry it!Repo
Examples
MusicBrainzOpen music encyclopedia that collects music metadataTry it!Repo
PokeAPIPokémon Data APITry it!Repo
Spacex LandA non official platform for SpaceX's data!Try it!Docs
SpotifySpotify gives you instant access to millions of songs - from old favorites to the latest hits.Try it!Repo
Examples
StratzDota 2 Statistics ApiTry it!Site
SWAPIStar Wars APITry it!Repo
TMDBThe Movie Database WrapperTry it!Repo

Demonstration-only APIs

APIDescriptionGraphiQLDocs/Repo
A-MazeEnter the maze, try to get out!Try it!Repo
Demotivational Quotes APIGet Random Demotivational quote and its authorTry it!Repo
GraphQL PokémonGet information of a Pokémon with GraphQL or Demo App!Try it!Repo
ClientRepo
MongoDB Northwind demoDemo App build on top of graphql-compose and mongooseTry it!
Try Relay version!
Docs
ServerRepo
ClientRepo
MongoDB TODO-ListTODO List using GraphQL and MongoDbTry it!Docs
Repo
PlanetsInformation about planets and exoplanets, including mass, radius, orbit, semimajor axis, and how it was discovered.Try it!Repo
Spotify GraphQL ServerThis demonstrates how to build a GraphQL server which fetches data from an external API (Spotify)Try it!Repo
Three.js demoDeclare a Three.js program with GraphQLTry it!Repo
UFC GraphQL ServerPublic UFC API turned into a GraphQL server. It's hosted by now.sh then, sometimes, it gets freeze.Try it!Repo
Google directions APIGraphQL wrapper for google directions API.Try it!Repo
FakeQLGraphQL API mocking as a service.Try it!Docs
The Rick and Morty APIAll the Rick and Morty information.Try it!Docs
UN SDG data series APIUN SDG statistical data served via GraphQL as JSON-LD objects mapped to RDF Data Cube VocabularyTry it!Code
Docs
Blog post
Weather APIRetrieve the current weather for any given cityTry it!Repo
Fake GraphQL APIMock user and to do dataTry it!Docs
Fruits APIInformation of fruit trees of the worldTry it!Docs

Download Details:
Author: APIs-guru
Source Code: https://github.com/APIs-guru/graphql-apis
License: MIT License

#graphql  #typescript #apis 

Graphql Apis: A Collective List Of Public GraphQL APIs

CppSharp: Tools & Libraries To Glue C/C++ APIs To High-level Languages

CppSharp is a tool and set of libraries which facilitates the usage of native C/C++ code with the .NET ecosystem.

It consumes C/C++ header and library files and generates the necessary glue code to surface the native API as a managed API. Such an API can be used to consume an existing native library in your managed code or add managed scripting support to a native codebase.

The supported target languages at present are C# and C++/CLI.

It can also be used as a library to parse native code into a syntax tree with a rich declaration and type information model.

Releases/Build Status

NuGet PackagesContinuous Integration
NuGetGitHub-actions

Libraries

AST

Mirrors the Clang's C/C++ AST and type system classes in C# APIs.

Check out Clang's AST introduction docs for more details about its architecture.

  • C++ declarations
  • C++ statements / expressions
  • C++ types
  • Class object layout
  • Declaration visitors
  • Type visitors

Parser

Provides APIs for parsing of C/C++ source code into a syntax tree.

  • Parsing of C/C++ source code
  • Parsing of libraries archives symbols
  • Parsing of shared libraries symbols
  • Based on the very accurate Clang C++ parser.

Generator

Generates the glue binding code from a syntax tree of the native code.

  • Multiple backends: C++/CLI and C# (P/Invoke)
  • Multiple ABIs: Itanium, MS, ARM, iOS
  • Multiple platforms: Windows, OS X and Linux
  • Multiple runtimes: .NET and Mono
  • C++ virtual methods overriding from managed code
  • C++ multiple inheritance by translating to C# interfaces
  • C++ std::string
  • C++ default parameter values
  • C/C++ semantic comments (Doxygen) to C# comments
  • Extensible bindings semantics via user passes and type mapping

Documentation

Please see the following resources for more information:

Getting Started

User's Manual

Developer's Manual

Community

Feel free to open up issues on Github for any problems you find.

You can also join us at our #managed-interop Gitter discussion channel.

Users

CppSharp is used by the following projects:

QtSharp

MonoGame

LLDBSharp

Xamarin

FFMPEG.net

FFmpeg bindings

Tizen bindings

libgd bindings

ChakraSharp

FFmpeg.AutoGen

GLFW3.NET

Please feel free to send us a pull request adding your own projects to the list above.

Download Details:
Author: mono
Source Code: https://github.com/mono/CppSharp
License: MIT License

#dotnet  #aspdotnet  #csharp #c #apis 

CppSharp: Tools & Libraries To Glue C/C++ APIs To High-level Languages

✨ Geo-Locate IPs With Python ✨

Geolocating an IP address is a convenient way to identify a user's real-world location.

We shall majorly be using requests library and JSON for today.

#python #codenewbies #apis #geolocation

Read More 👇

https://blog.octachart.com/geo-locate-ips-with-python

✨ Geo-Locate IPs With Python ✨
Ryleigh  Hamill

Ryleigh Hamill

1627155240

instructions for Create Simple APIs In Node JS in 1 minutes

In This video, learn about instructions for Create Simple APIs In Node JS Fluently

#node js #apis

instructions for Create Simple APIs In Node JS in 1 minutes
Kaia  Schmitt

Kaia Schmitt

1627116000

GetX Flutter Tutorials - Part II | Advanced Features and APIs | GetX | Flutter

GetX Flutter Tutorials - Part - II.
GetX Flutter Tutorials - Part - I - https://youtu.be/vVoyu-ExPJ0
GitHub - https://github.com/theindianinnovation/GETX_TUTORIAL1

#flutter #getx #apis #advanced features #getx flutter tutorials

GetX Flutter Tutorials - Part II | Advanced Features and APIs | GetX | Flutter
Ruthie  Blanda

Ruthie Blanda

1626966452

Laravel and External APIs: Get Data with HTTP Client

This video will show a few examples of a built-in Laravel HTTP client and how easy it is to interact with external APIs to get some data, both public and with some authentication methods.

#laravel #external apis #apis #http

Laravel and External APIs: Get Data with HTTP Client