Build Status


A client wrapper for webfaction's RPC API.

Official reference:

Webfaction info: (affiliate link)


  1. pubspec.yaml:
  sdk: '>=2.0.0 <3.0.0'

  webfaction_api: '>=1.0.0'
  1. pub get


~/dart-webfaction-api/ $ dartdoc
~/dart-webfaction-api/ $ dhttpd --path doc/api


import 'package:webfaction_api/client.dart';
import 'package:webfaction_api/response.dart';

main() async {
  var client = Client('username', 'password', 'SomeServer543');
  await client.login();

  // or

  client.login().then((response) async {
    List<Map> rawResponse = await;

    // Response objects imported from `response.dart`
    List<App> appListManuallyCreated = await
        .then((response) => => App.fromMap(data)));

    App newApp = await
        .create('MyNewApp', 'django-2.0.5_mod_wsgi-4.6.4_python-3.6')
        .then((response) => App.fromMap(response));

    // Or pass objects around
    App app = App('MyNewApp', 'django-2.0.5_mod_wsgi-4.6.4_python-3.6');
        .then((_) =>;

Usage Summary

  1. Import client.dart for the client and API classes. Import response.dart to use the response objects and related helper function
import 'package:webfaction_api/client.dart';
import 'package:webfaction_api/response.dart';
  1. Instantiate a client with your webfaction username, password, and server name
var client = Client('username', 'password, 'Server153');
  1. Login. The session ID is stored in the client so there is no need to pass it to subsequent calls. According to webfaction, the session ID remains valid for one hour
  1. Call api methods.

Method location

The webfaction API is large and flat. In order to tidy things up and make code completion more helpful, the methods were grouped and scoped to class properties corresponding to the section or subsection they appear under on the API reference page.

For example, methods under Applications are found on<method>

A couple slight deviations from this convention are as follows:

  • Databases: client.db
  • Email -> Addresses:
  • Email -> Mailboxes: client.mailbox
  • Miscellaneous: client.misc
  • General -> Login: client.login(...)

Method naming

The method names use camel case instead of snake case, as per dart style recommendations, and the 'section' is removed from the name:

create_db becomes client.db.create

create_db_user becomes client.db.createUser

API response objects

A collection of dumb objects have been provided that represent API input or output.

Most methods have a corresponding <methodName>FromInstance or FromInstances method that can be called with objects instead of manually passing individual parameters.

Objects intended to be used with API methods that return data have a .fromMap factory constructor that can be used to instanciate directly with the response data.


Provides an RPC adapter to be used to replace the default XML RPC adapter
This library defines the interaction with the webfaction API. Client is the intended entry point, but Api and its subclasses have been exposed so you can use them directly as you discover limitations or bugs
This library contains simple objects that can be passed around to work with api responses