Dart
Dart
Shopify Basic Authentication: Get List of Products
See more Shopify Examples
Demonstrates how to send a simple HTTP GET request with Basic authentication to get a list of products.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
final http = CkHttp();
// Use your Shopify store's Admin API key and password.
http.login = 'admin3_api_key';
http.password = 'admin3_password';
http.basicAuth = true;
final String jsonStr;
try {
jsonStr = http.quickGetStr('https://mystore.myshopify.com/admin/api/2020-07/products.json');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
print('Response status code: ${http.lastStatus}');
print('JSON response:');
print(jsonStr);
}