Skip to content
Developer

Code samples and Dart package

Where the code samples come from and how to use the Dart package iw_erp_api.

Every endpoint has samples in cURL, JavaScript, Python, PHP, C#, Java, Go and Dart. The chosen language applies to the whole page and is remembered for your next visit.

How the samples are made

The samples are generated from the OpenAPI description when this site is built. cURL, JavaScript, Python, PHP, C#, Java and Go come from HTTPSnippet, the library many other API docs use as well. Values such as 42 or Lena are example data. Replace <TOKEN> with your API access token.

Dart

For Dart we show the matching controller of our iw_erp_api package (repository inwendo/iw_erp_api_dart) wherever there is one. The package takes care of headers, wrapper objects and reading responses into models:

import 'package:iw_erp_api/clients/crm_person_controller.dart';
import 'package:iw_erp_api/logic/iw_api_state.dart';

IwApiState().host = 'your-instance.iw-erp.de';
IwApiState().currentJwtApiToken = '<TOKEN>';

final result = await CrmPersonController.get('42');
if (result.success) {
  print(result.data);
}

For endpoints without a controller in the package, the Dart sample uses package:http. A note above each sample says which variant it is.