Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Objective-C Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Objective-C) Faire - Get All Products

See more Faire Examples

Retrieves a list of products, ordered ascending by updated_at. By default, it only returns non-deleted products.

For more information, see https://faire.github.io/external-api-docs/#get-all-products

Chilkat Objective-C Library Downloads

MAC OS X (Cocoa) Libs

iOS Libs

#import <CkoHttp.h>
#import <CkoJsonObject.h>
#import <CkoHttpResponse.h>
#import <CkoStringBuilder.h>
#import <NSString.h>

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

CkoHttp *http = [[CkoHttp alloc] init];
BOOL success;

// Implements the following CURL command:

// curl -X GET -H "X-FAIRE-ACCESS-TOKEN: <access_token>" -d "limit=50" -d "page=1" https://www.faire.com/api/v1/products

// Use the following online tool to generate HTTP code from a CURL command
// Convert a cURL Command to HTTP Source Code

CkoJsonObject *queryParams = [[CkoJsonObject alloc] init];
[queryParams UpdateInt: @"limit" value: [NSNumber numberWithInt: 50]];
[queryParams UpdateInt: @"page" value: [NSNumber numberWithInt: 1]];

[http SetRequestHeader: @"X-FAIRE-ACCESS-TOKEN" value: @"<access_token>"];

CkoHttpResponse *resp = [http QuickRequestParams: @"GET" url: @"https://www.faire.com/api/v1/products" json: queryParams];
if (http.LastMethodSuccess == NO) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
[resp GetBodySb: sbResponseBody];

CkoJsonObject *jResp = [[CkoJsonObject alloc] init];
[jResp LoadSb: sbResponseBody];
jResp.EmitCompact = NO;

NSLog(@"%@",@"Response Body:");
NSLog(@"%@",[jResp Emit]);

int respStatusCode = [resp.StatusCode intValue];
NSLog(@"%@%d",@"Response Status Code = ",respStatusCode);
if (respStatusCode >= 400) {
    NSLog(@"%@",@"Response Header:");
    NSLog(@"%@",resp.Header);
    NSLog(@"%@",@"Failed.");

    return;
}

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "page": 1,
//   "limit": 50,
//   "products": [
//     {
//       "id": "p_123",
//       "brand_id": "b_abc",
//       "short_description": "Our candles smell fantastic. Want to know how good? Read our description!",
//       "description": "Glad you decided to read our description! We have significantly more characters to describe to you just how good our candles smell.",
//       "wholesale_price_cents": 500,
//       "retail_price_cents": 1000,
//       "sale_state": "FOR_SALE",
//       "active": true,
//       "deleted": false,
//       "name": "Faire's fantastic candle",
//       "unit_multiplier": 8,
//       "taxonomy_type": {
//         "id": "tt_23nl3bzl00",
//         "name": "Votive Candle"
//       },
//       "options": [
//       ],
//       "created_at": "20190314T000915.000Z",
//       "updated_at": "20190315T000915.000Z"
//     }
//   ]
// }

// Sample code for parsing the JSON response...
// Use the following online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON

NSString *id = 0;
NSString *brand_id = 0;
NSString *short_description = 0;
NSString *description = 0;
int wholesale_price_cents;
int retail_price_cents;
NSString *sale_state = 0;
BOOL active;
BOOL deleted;
NSString *name = 0;
int unit_multiplier;
NSString *taxonomy_typeId = 0;
NSString *taxonomy_typeName = 0;
NSString *created_at = 0;
NSString *updated_at = 0;
int j;
int count_j;

int page = [[jResp IntOf: @"page"] intValue];
int limit = [[jResp IntOf: @"limit"] intValue];
int i = 0;
int count_i = [[jResp SizeOfArray: @"products"] intValue];
while (i < count_i) {
    jResp.I = [NSNumber numberWithInt: i];
    id = [jResp StringOf: @"products[i].id"];
    brand_id = [jResp StringOf: @"products[i].brand_id"];
    short_description = [jResp StringOf: @"products[i].short_description"];
    description = [jResp StringOf: @"products[i].description"];
    wholesale_price_cents = [[jResp IntOf: @"products[i].wholesale_price_cents"] intValue];
    retail_price_cents = [[jResp IntOf: @"products[i].retail_price_cents"] intValue];
    sale_state = [jResp StringOf: @"products[i].sale_state"];
    active = [jResp BoolOf: @"products[i].active"];
    deleted = [jResp BoolOf: @"products[i].deleted"];
    name = [jResp StringOf: @"products[i].name"];
    unit_multiplier = [[jResp IntOf: @"products[i].unit_multiplier"] intValue];
    taxonomy_typeId = [jResp StringOf: @"products[i].taxonomy_type.id"];
    taxonomy_typeName = [jResp StringOf: @"products[i].taxonomy_type.name"];
    created_at = [jResp StringOf: @"products[i].created_at"];
    updated_at = [jResp StringOf: @"products[i].updated_at"];
    j = 0;
    count_j = [[jResp SizeOfArray: @"products[i].options"] intValue];
    while (j < count_j) {
        jResp.J = [NSNumber numberWithInt: j];
        j = j + 1;
    }

    i = i + 1;
}
 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.