Last active
March 29, 2016 14:53
-
-
Save Mozu-CS/aab03c151fe037c0740c to your computer and use it in GitHub Desktop.
Basic Java SDK Setup and Usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
group 'com.amsxbg' | |
version '1.0-SNAPSHOT' | |
apply plugin: 'java' | |
apply plugin: 'application' | |
mainClassName = 'com.amsxbg.GetCustomerAccountsCount' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
testCompile group: 'junit', name: 'junit', version: '4.11' | |
compile ('com.mozu:mozu-api-java:1.19.1') { | |
exclude group: 'javax.sql' | |
exclude group: 'javax.transaction' | |
exclude group: 'jcs' | |
exclude group: 'javax.servlet' | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.amsxbg; | |
import com.mozu.api.MozuApiContext; | |
import com.mozu.api.contracts.appdev.AppAuthInfo; | |
import com.mozu.api.resources.commerce.customer.CustomerAccountResource; | |
import com.mozu.api.security.AppAuthenticator; | |
public class GetCustomerAccountsCount { | |
public static void main(String[] args){ | |
AppAuthInfo appAuthInfo = new AppAuthInfo(); | |
//Use mozu_config.properties file to handle AppId and SharedSecret | |
appAuthInfo.setApplicationId("Enter AppId"); | |
appAuthInfo.setSharedSecret("Enter SharedSecret"); | |
AppAuthenticator.initialize(appAuthInfo); | |
//Use mozu_config.properties file to handle TenantId and SiteId | |
MozuApiContext apiContext = new MozuApiContext(12345, 54321); | |
CustomerAccountResource customerAccountResource = new CustomerAccountResource(apiContext); | |
try { | |
System.out.println("Total Count: " + customerAccountResource.getAccounts().getTotalCount()); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment