WalmartOpenApi 1.1.0

WalmartOpenApi 1.1.0

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Jun 2016

Maintained by Siddhant Goyal.



 
Depends on:
AFNetworking~> 3
JSONModel~> 1.2
ISO8601~> 0.5
 

  • By
  • @WalmartLabs

WalmartOpenApi Mobile SDK for iOS

Walmart is the world's largest retailer, and the Walmart Open API provides access to our extensive product catalog, thus enabling digital distribution partners to earn substantial affiliate revenues from customer referrals.

Requirements

  • Xcode 7.2 or later
  • iOS 8.0 or later

Installation

Installation with CocoaPods

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.0.0+ is required to build WalmartOpenApi.

Podfile

To integrate WalmartOpenApi into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'MyApp' do
    pod 'WalmartOpenApi'
end

If you are using Swift, be sure to add use_frameworks! and set your target to iOS 8+:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

target 'MyApp' do
    pod 'WalmartOpenApi'
end

Then, run the following command:

$ pod install

Get your apikey

To get started, sign up here for a free developer account and get your API key!

Getting Started with Objective C

  1. Import the WalmartOpenApi header.

    #include <WalmartOpenApi/WalmartOpenApi.h>
  2. Make a call to the Walmart Open Api endpoints by creating the corresponding api instance. See the below example for ProductLookUpApi.

    
    NSString *itemId = @"itemId_example"; // 
    NSString *apiKey = @"apiKey_example"; // Your API access key
    NSString *lsPublisherId = @"lsPublisherId_example"; // Your Rakuten access key (optional)
    NSString *format = @"json"; // Type of response required, (currently only JSON supported)
    
    WMTOAProductLookupApi *apiInstance = [[WMTOAProductLookupApi alloc] init];
    
        // Get real time item status including price and availability
    [apiInstance getItemWithItemId:itemId
        apiKey:apiKey
        lsPublisherId:lsPublisherId
        format:format
                  completionHandler: ^(WMTOAItem* output, NSError* error)) {
                                if (output) {
                                    NSLog(@"%@", output);
                                }
                                if (error) {
                                    NSLog(@"Error: %@", error);
                                }
                            }];
    

Getting started with Swift

  1. Import the WalmartOpenHeader

    import WalmartOpenApi
  2. Make a call to the Walmart Open Api endpoints by creating the corresponding api instance. See the below example for ProductLookUpApi.

    let itemId = "itemId_example" // 
    let apiKey = "apiKey_example" // Your API access key
    let lsPublisherId = "lsPublisherId_example" // Your Rakuten access key (optional)
    let format = "json" // Type of response required, (currently only JSON supported)
    
    let apiInstance = WMTOAProductLookupApi()
    apiInstance.getItemWithItemId(itemId, apiKey: apiKey, lsPublisherId: lsPublisherId,
        format: format, completionHandler: { (output, error) -> Void in
            if (output != nil) {
                print(output)
            }
            if (error != nil) {
                print(error)
            }
    })

Fixing Xcode's "Include of non-modular header inside framework module" Error

If you are receive an error when compiling about "Include of non-modular header inside framework module". you can resolve it by :

Set your project target's CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES flag to YES. This configuration setting can also be found under your target's Build Settings > Allow Non-modular Includes in Framework Modules within Xcode.

Here's more information from Apple's Developer Forums regarding the issue: https://forums.developer.apple.com/message/78028

The compiler will run into issues if the same header file is accessible both through Header Search Paths (-I, -isystem) and Framework Search Paths (-F, -iframework), even if there are symbolic links involved. In these cases, you should prefer using Framework Search Paths. (Note that this invalid configuration may be generated by external systems, such as CocoaPods.)

Recommendation

It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issue.

Learn More

Please go through the detailed documentation for the availaible endpoints of WalmartOpenApi here

Have a Query? Let us know

Visit our developer forums to give feedback and to connect with other users of the SDK.

Author

@WalmartLabs

License

See the LICENSE file for more info.