Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.0.0+

BrickLink OAuth1 using Chilkat HTTP

See more BrickLink Examples

Demonstrates sending an api.bricklink.com request with OAuth1 authentication using Chilkat HTTP.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final http = CkHttp();

  http.oAuth1 = true;
  http.oAuthConsumerKey = 'Your Consumer Key';
  http.oAuthConsumerSecret = 'Your Consumer Secret';
  http.oAuthToken = 'Your OAuth1 Token';
  http.oAuthTokenSecret = 'Your Token Secret';
  http.oAuthSigMethod = 'HMAC-SHA1';

  final resp = CkHttpResponse();
  try {
    http.httpNoBody('GET', 'https://api.bricklink.com/api/store/v1/orders?direction=in', resp);
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  print('Response status code = ${resp.statusCode}');

  final json = CkJsonObject();
  resp.getBodyJson(json);

  json.emitCompact = false;
  print(json.emit());
}