Sample code for 30+ languages & platforms
React Native 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 React Native Downloads

React Native
import { Http, HttpResponse, JsonObject } from '@chilkat/react-native'

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

  const http = new Http();

  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';

  const resp = new HttpResponse();
  try {
    await http.httpNoBodyAsync('GET', 'https://api.bricklink.com/api/store/v1/orders?direction=in', resp);
  } catch {
    console.log(http.lastErrorText);
    return;
  }

  console.log(`Response status code = ${resp.statusCode}`);

  const json = new JsonObject();
  resp.getBodyJson(json);

  json.emitCompact = false;
  console.log(json.emit());
}