Version 0.6.2  
Docs

Avatars API

Client integration with     code examples.


The Avatars service aims to help you complete everyday tasks related to your app image, icons, and avatars.

The Avatars service allows you to fetch country flags, browser icons, payment methods logos, remote websites favicons, generate QR codes, and manipulate remote images URLs.

All endpoints in this service allow you to resize, crop, and change the output image quality for maximum performance and visibility in your app.

Get Credit Card Icon

GET/avatars/credit-cards/{code}

Need to display your users with your billing method or their payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings.

Arguments

Name Type Description
code required string

Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    let result = sdk.avatars.getCreditCard('amex');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getCreditCard(
        code: 'amex',
      );
    
      print(result); // Resource URL string
    }
  • import 'package:appwrite_dev/appwrite_dev.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getCreditCard(
        code: 'amex',
      );
    
      print(result); // Resource URL string
    }

Get Browser Icon

GET/avatars/browsers/{code}

You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings.

Arguments

Name Type Description
code required string

Browser Code.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    let result = sdk.avatars.getBrowser('aa');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getBrowser(
        code: 'aa',
      );
    
      print(result); // Resource URL string
    }
  • import 'package:appwrite_dev/appwrite_dev.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getBrowser(
        code: 'aa',
      );
    
      print(result); // Resource URL string
    }

Get Country Flag

GET/avatars/flags/{code}

You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings.

Arguments

Name Type Description
code required string

Country Code. ISO Alpha-2 country code format.

width optional integer

Image width. Pass an integer between 0 to 2000. Defaults to 100.

height optional integer

Image height. Pass an integer between 0 to 2000. Defaults to 100.

quality optional integer

Image quality. Pass an integer between 0 to 100. Defaults to 100.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    let result = sdk.avatars.getFlag('af');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getFlag(
        code: 'af',
      );
    
      print(result); // Resource URL string
    }
  • import 'package:appwrite_dev/appwrite_dev.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getFlag(
        code: 'af',
      );
    
      print(result); // Resource URL string
    }

Get Image from URL

GET/avatars/image

Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol.

Arguments

Name Type Description
url required string

Image URL which you want to crop.

width optional integer

Resize preview image width, Pass an integer between 0 to 2000.

height optional integer

Resize preview image height, Pass an integer between 0 to 2000.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    let result = sdk.avatars.getImage('https://example.com');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getImage(
        url: 'https://example.com',
      );
    
      print(result); // Resource URL string
    }
  • import 'package:appwrite_dev/appwrite_dev.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getImage(
        url: 'https://example.com',
      );
    
      print(result); // Resource URL string
    }

Get Favicon

GET/avatars/favicon

Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote website URL.

Arguments

Name Type Description
url required string

Website URL which you want to fetch the favicon from.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    let result = sdk.avatars.getFavicon('https://example.com');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getFavicon(
        url: 'https://example.com',
      );
    
      print(result); // Resource URL string
    }
  • import 'package:appwrite_dev/appwrite_dev.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getFavicon(
        url: 'https://example.com',
      );
    
      print(result); // Resource URL string
    }

Get QR Code

GET/avatars/qr

Converts a given plain text to a QR code image. You can use the query parameters to change the size and style of the resulting image.

Arguments

Name Type Description
text required string

Plain text to be converted to QR code image.

size optional integer

QR code size. Pass an integer between 0 to 1000. Defaults to 400.

margin optional integer

Margin from edge. Pass an integer between 0 to 10. Defaults to 1.

download optional integer

Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
    ;
    
    let result = sdk.avatars.getQR('[TEXT]');
    
    console.log(result); // Resource URL
  • import 'package:appwrite/appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getQR(
        text: '[TEXT]',
      );
    
      print(result); // Resource URL string
    }
  • import 'package:appwrite_dev/appwrite_dev.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Avatars avatars = Avatars(client);
    
      client
        .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
      ;
    
      String result = avatars.getQR(
        text: '[TEXT]',
      );
    
      print(result); // Resource URL string
    }