glpi_dart 0.2.1 copy "glpi_dart: ^0.2.1" to clipboard
glpi_dart: ^0.2.1 copied to clipboard

This library is a wrapper around the GLPI API, it provides a simple way to access he API. It is based on the Dart http library so it can be used ont dartvm and dartweb.

example/lib/main.dart

import 'package:glpi_dart/glpi_dart.dart';

void main() async {
  // We recommend to use a secret management library like dotenv
  // to store your credentials in a file
  String username = 'admin';
  String password = 'admin';
  String baseUrl = 'http://example.com/apirest.php';
  GlpiClient client = GlpiClient(baseUrl);
  String? sessionToken;

  // Get the session token
  try {
    final response =
        await client.initSessionUsernamePassword(username, password);
    sessionToken = response['session_token'];

    client.sessionToken = sessionToken;
  } on GlpiException catch (e) {
    // In case of will get the http status code (e.code) and the message (e.reason['error'])
    print('${e.code} - ${e.error} - ${e.message}');
  }

  print(sessionToken);
}
2
likes
120
pub points
9%
popularity

Publisher

verified publisherprojetretro.io

This library is a wrapper around the GLPI API, it provides a simple way to access he API. It is based on the Dart http library so it can be used ont dartvm and dartweb.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

http

More

Packages that depend on glpi_dart