Multichannel Solutions Java OpenAPI Client Integration Guide

This guide explains how to generate a strongly typed Java client from the Walmart Multi-Channel Solutions (MCS) provided OpenAPI specification and use it to call MCS APIs.

The integration uses OpenAPI Generator to produce Java models and API clients directly from the OpenAPI definition, reducing manual coding and accelerating onboarding.

Download and unzip the Multichannel Solutions OpenAPI Specification. Use the multiChannelSolutions.yaml file as input to the OpenAPI Generator to generate a Java client.

Prerequisites

Before you begin, ensure the following are available on your system:

  • Internet access to download dependencies
  • Java 8 or later
  • Apache Maven 3.9 or later
  • Active Walmart Developer Portal credentials

High-level integration flow

The following steps outline the end-to-end process for generating a Java client from the MCS OpenAPI specification and using it to make authenticated API calls.

  • Download the MCS OpenAPI specification from the Developer Portal.
  • Generate a Java client using OpenAPI Generator.
  • Build the generated client with Maven.
  • Add the client to your application.
  • Configure authentication and required request headers.
  • Invoke MCS APIs using the generated API classes.

Step 1: Create a working directory

Create a new directory for the integration.

mkdir walmart-mcs-integration
cd walmart-mcs-integration

Step 2: Prepare OpenAPI Specification and Generator

Step 2.1 Add the OpenAPI Specification

Download and unzip the MCS OpenAPI specification from the Developer Portal and place it in the working directory.

walmart-mcs-integration/
└── multiChannelSolutions.yaml

Step 2.2 Download OpenAPI Generator (JAR)

Download the OpenAPI Generator CLI JAR.

On Windows PowerShell, always use -o to avoid binary output warnings.

curl -L https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/7.2.0/openapi-generator-cli-7.2.0.jar \ -o openapi-generator-cli.jar

Step 3: Generate the Java client

Run the following command from the walmart-mcs-integration directory.

java -jar openapi-generator-cli.jar generate \ -i multiChannelSolutions.yaml \ -g java \ -o walmart-mcs-java-client \ --library apache-httpclient \ --group-id com.walmart.marketplace.mcs \ --artifact-id walmart-mcs-client \ --artifact-version 1.0.0 \ --additional-properties=apiPackage=com.walmart.marketplace.mcs.api,modelPackage=com.walmart.marketplace.mcs.model

This command:

  • Reads the OpenAPI specification
  • Generates Java models, APIs, and client infrastructure
  • Uses Apache HttpClient for HTTP communication

Step 4: Build the generated client

Navigate to the generated project and build it using Maven.

cd walmart-mcs-java-client
mvn clean install

This command:

  • Compiles the generated source code
  • Downloads required dependencies
  • Installs the client artifact into your local Maven repository

Step 5: Add the client to your application

You can use the generated client in one of the following ways.

Option A: Use as a standalone project

This approach is useful for quick testing or proof-of-concept development. Add your Java code directly under:

walmart-mcs-java-client/src/main/java

Option B: Use as a Maven dependency (recommended)

In your application’s pom.xml, add:

<dependency> <groupId>com.walmart.marketplace.mcs</groupId> <artifactId>walmart-mcs-client</artifactId> <version>1.0.0</version>
</dependency>

Step 6: Configure authentication and required headers

All the MCS API requests must include the following headers.

HeaderDescription
AuthorizationBasic Base64(clientId:clientSecret)
loggedInUserEmail Id of the logged in user
WM_SEC.ACCESS_TOKENOAuth access token from the Walmart Token API
WM_QOS.CORRELATION_IDUnique UUID per request
WM_SVC.NAMEWalmart service name

Important:
The OAuth access token must be generated using the client credentials flow before invoking any MCS APIs. For more details, refer to Get an access token using Token API.

Examples: Call an MCS API with the generated client

This section gives detailed examples on how you can use the generated Java client to call Multichannel Solutions (MCS) APIs.

Call fulfillment order details API

The following example demonstrates how to call the fulfillment order details API using the generated Java client.

Thread-safe ApiClient provider

Create one ApiClient instance per thread when using the client in a multithreaded environment.

import com.walmart.marketplace.mcs.ApiClient;
import com.walmart.marketplace.mcs.ApiException;
import com.walmart.marketplace.mcs.Configuration;
import com.walmart.marketplace.mcs.api.AuthenticationApi;
import com.walmart.marketplace.mcs.model.TokenResponse; import java.util.UUID; public final class ApiClientProvider { private static final ThreadLocal<ApiClient> CLIENT = ThreadLocal.withInitial(() -> { ApiClient client = Configuration.getDefaultApiClient(); client.setBasePath("https://marketplace.walmartapis.com"); // 1️⃣ Basic auth for token client.setUsername("clientId"); client.setPassword("clientSecret"); // 2️⃣ Call token API once AuthenticationApi authApi = new AuthenticationApi(client); TokenResponse token = null; try { token = authApi.getAccessToken(UUID.randomUUID(), "walmart-mcs", "client_credentials"); System.out.println("Token : " + token); } catch (ApiException e) { throw new RuntimeException(e); } // 3️⃣ Set Walmart access token client.setApiKey(token.getAccessToken()); return client; }); public static ApiClient get() { ApiClient client = CLIENT.get(); // Correlation ID must be PER REQUEST client.addDefaultHeader( "WM_QOS.CORRELATION_ID", UUID.randomUUID().toString() ); //Walmart service name client.addDefaultHeader("WM_SVC.NAME", "Walmart MCS"); // Logged in user client.addDefaultHeader("loggedInUser", "abc"); return client; }
}

Call fulfillment order details API

import com.walmart.marketplace.mcs.ApiClient;
import com.walmart.marketplace.mcs.ApiException;
import com.walmart.marketplace.mcs.api.McsApi;
import com.walmart.marketplace.mcs.model.OrderDetailsResponse; public class Main { public static void main(String[] args) throws ApiException { ApiClient apiClient = ApiClientProvider.get(); McsApi mcsApi = new McsApi(apiClient); String sellerOrderId = "1234567890"; OrderDetailsResponse response = mcsApi.orderDetails( null, null, null, null, sellerOrderId, null, null, null, null, null, null, new java.util.HashMap<>() ); System.out.println("Order details response: " + response); }
}

Call create customer order API

The following example demonstrates how to call the create customer order API using the generated Java client.

package org.example; import com.walmart.marketplace.mcs.ApiClient;
import com.walmart.marketplace.mcs.ApiException;
import com.walmart.marketplace.mcs.api.McsApi;
import com.walmart.marketplace.mcs.model.CreateOrderItems;
import com.walmart.marketplace.mcs.model.CreateOrderRequest;
import com.walmart.marketplace.mcs.model.CreateOrderRequestPayload;
import com.walmart.marketplace.mcs.model.CustomerContact;
import com.walmart.marketplace.mcs.model.CustomerDetails;
import com.walmart.marketplace.mcs.model.CustomerName;
import com.walmart.marketplace.mcs.model.ItemDetail;
import com.walmart.marketplace.mcs.model.RequestItemQty;
import com.walmart.marketplace.mcs.model.ShippingDetails;
import com.walmart.marketplace.mcs.model.ShippingDetailsAddress;
import com.walmart.marketplace.mcs.model.ShippingMethod; public class Main { public static void main(String[] args) throws ApiException { ApiClient apiClient = ApiClientProvider.get(); McsApi mcsApi = new McsApi(apiClient); com.walmart.marketplace.mcs.model.CustomerContact customerContact = new CustomerContact() .name(new CustomerName() .firstName("firstName") .lastName("lastName") ) .phone("1234567890") .email("[email protected]"); com.walmart.marketplace.mcs.model.ShippingDetailsAddress shippingDetailsAddress = new ShippingDetailsAddress() .line1("line1") .line2("line2") .city("city") .state("state") .country("US") .zip("12345") .addressType("RESIDENTIAL"); com.walmart.marketplace.mcs.model.CreateOrderRequestPayload createOrderRequestPayload = new CreateOrderRequestPayload() .orderChannelId("orderChannelId") .customerOrderNo("customerOrderNo") .customer(new CustomerDetails() .contact(customerContact) ) .addOrderItemsItem(new CreateOrderItems() .sellerLineId("1") .itemDetail(new ItemDetail().sku("SKU")) .qty(new RequestItemQty() .unitOfMeasure("EACH") .measurementValue(1) ) .shippingMethod(ShippingMethod.EXPEDITED) // "ENUM EXPEDITED OR STANDARD" .shippingTo(new ShippingDetails() .contact(customerContact) .address(shippingDetailsAddress) ) ); CreateOrderRequest createOrderRequest = new CreateOrderRequest(); createOrderRequest.payload(createOrderRequestPayload); com.walmart.marketplace.mcs.model.OrderOperationResponse orderResponse = mcsApi.createOrder(createOrderRequest); System.out.println(orderResponse); } }