WmV4ApisSDK 0.1.0

dotnet add package WmV4ApisSDK --version 0.1.0
                    
NuGet\Install-Package WmV4ApisSDK -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WmV4ApisSDK" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WmV4ApisSDK" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="WmV4ApisSDK" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WmV4ApisSDK --version 0.1.0
                    
#r "nuget: WmV4ApisSDK, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WmV4ApisSDK@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WmV4ApisSDK&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=WmV4ApisSDK&version=0.1.0
                    
Install as a Cake Tool

Walmart APIs

Built with APIMatic License: MIT

The Walmart APIs SDK for .NET provides access to the Walmart APIs REST APIs from .NET applications.

Looking for a specific signature, model, enum, or error type? This SDK ships a generated, machine-readable SDK map — a lookup index of the SDK's entire C# surface. Consult it before grepping or scanning the source tree; it answers most contract questions directly and, when a source file is genuinely needed, names the exact one to open. Details under SDK map.

Use the Authorization API to obtain OAuth access tokens for Walmart Marketplace V4 APIs.

Seller applications can use the client_credentials grant to obtain an access token. Solution Provider applications can use the authorization_code grant for delegated access and the refresh_token grant when a refresh token is available.

POST /v4/auth/token supports the following grant types:

  • client_credentials for seller-direct authorization.
  • authorization_code for delegated Solution Provider authorization.
  • refresh_token for delegated authorization using a previously issued refresh token.

Public clients using the authorization_code grant must use Proof Key for Code Exchange (PKCE) with the S256 challenge method. Confidential clients can authenticate at the token operation as described in the operation requirements.

Access tokens use the Bearer token type. Send the access token with Marketplace V4 API requests as Authorization: Bearer <token>. Do not use WM_SEC.ACCESS_TOKEN for V4 requests.

Treat access tokens, refresh tokens, and client secrets as sensitive values and do not log them. , The Catalog Items API lets you search for products in the Walmart Marketplace catalog and retrieve detailed catalog item information. Search by keywords, Walmart Item IDs, GTINs, UPCs, or seller SKUs, and retrieve product attributes, identifiers, images, product types, and other available catalog information., Submit analytics queries and retrieve structured data from Walmart's data platform. Modeled after Walmart Seller API Data Kiosk API.

ADR pending: GraphQL vs REST query language — see docs/adr/ once filed. Until the ADR resolves, the query body is treated as an opaque string.

Pod Owner: Pod 4 — Feeds & Reports Implementation target: Walmart Analytics / Data Platform, Submit bulk data to Walmart Marketplace via asynchronous feed processing. Sellers submit a feed file in a single API call; the server handles document storage and initiates async processing. Poll feed status with the feedId returned in the submission response.

Pod Owner: Pod 4 — Feeds & Reports Implementation target: Walmart Feed Service / Bulk Operations, Use the Walmart Fulfillment Services (WFS) Inbound Plans API to create and manage inbound plans for shipments to Walmart fulfillment centers., WFS Inbound Delivery Windows, Self-Ship Appointments & Operation Status API. Walmart Seller API — Fulfillment Inbound contract. Terminology: WFS = Walmart Fulfillment Services, Ship Node = fulfillment center., WFS Inbound Packing. Walmart Seller API — Fulfillment Inbound contract. Terminology: WFS = Walmart Fulfillment Services, Ship Node = fulfillment center., WFS Inbound Packing & Placement API. Walmart Seller API — Fulfillment Inbound contract. Terminology: WFS = Walmart Fulfillment Services, Ship Node = fulfillment center., WFS Inbound Items, Compliance, Labels & Prep API. Walmart Seller API — Fulfillment Inbound contract. Terminology: WFS = Walmart Fulfillment Services, Ship Node = fulfillment center., WFS Inbound Shipments API. Walmart Seller API — Fulfillment Inbound contract. Terminology: WFS = Walmart Fulfillment Services, Ship Node = fulfillment center., Create and manage WFS (Walmart Fulfillment Services) outbound fulfillment orders. Sellers ship inventory to Walmart ship nodes; Walmart picks, packs, and ships to end customers.

Pod Owner: Pod 2 — Orders & Fulfillment Implementation target: WFS Outbound / Ship Node Service

Delivery priority: Phase 2 — Pod 2 is prioritizing fulfillment-inbound first. See PHASE-2.md in this service's directory for what that does and doesn't mean (bug/honesty fixes still welcome; new endpoints on hold)., Manage seller inventory on the Walmart Marketplace.

Pod Owner: Pod 3 — Inventory & Pricing Implementation target: Walmart Inventory Service, Create, fully update, patch, and delete listings items for sellers on the Walmart Marketplace. Modeled after Walmart Seller API Listings Items API.

Pod Owner: Pod 1 — Items & Catalog Implementation target: Walmart Item Setup Service, Get information about listing restrictions on items in the Walmart Marketplace. Identifies compliance blocks, category restrictions, and approval requirements.

Pod Owner: Pod 3 — Inventory & Pricing Implementation target: Walmart Item Compliance / Restriction Service, SUPERSEDED — NOT SCHEDULED FOR IMPLEMENTATION. the Merchant Fulfillment API is obsolete: its operations are covered by the Shipping API, and both front the same upstream (Ship With Walmart). Per Suresh's SWW-consolidation analysis, every operation below is marked counts toward Pod 2 implementation scope. This spec is retained for reference only (tombstone) — no code is being built against it. New seller-fulfilled shipping work goes to the Shipping API.

Tracking: (this deprecation). The one partial-coverage gap (MFN full-record getShipment has no single the Shipping API equivalent) is owned by Suresh for decision in .


Get eligible shipping services and purchase shipping labels for seller-fulfilled orders. Modeled after Walmart Seller API Merchant Fulfillment API.

Pod Owner: Pod 2 — Orders & Fulfillment Implementation target: Ship With Walmart (SWW) — SWW-LABEL-SERVICE (internal /v3/sww/labels/* synchronous REST; see docs/mapper/mfn-mapper-feasibility.md), Use the Orders API to retrieve and manage Walmart Marketplace orders, including order details, order lines, fulfillment updates, cancellations, refunds, and delivery information., Unified Payments domain API for Walmart Marketplace sellers. Consolidates Pod 5 (Finances / financial event reporting) and Pod 6 (Outbound Payments — settlement, reconciliation, payout execution) into a single service under the Payments domain .

Category A (7 routes): Reporting — delegated to mp-payment-reporting upstream. Category B (9 routes): Execution — delegated to GMPPayments upstream. Finances (4 routes): Financial event reporting — delegated to GMP partnerTxnSearch and commission endpoints (, ).

Routes with x-walmart-pii: true contain order/seller PII and require an RDT issued by the Tokens service (Pod 0, ) in production.

Domain Owner: Payments Domain (consolidated Pod 5 + Pod 6) Tech Lead: @cssehga Replaces: the payments settlement backend (v3 BFF); the Payments API (Pod 5), The Product Pricing API retrieves pricing and offer information for seller items, compares competitive pricing, and returns the lowest-priced offers for Walmart items. Batch operations retrieve offer information for multiple items or seller SKUs in a single request., The Product Fees API returns estimated fees for seller items based on item, pricing, and fulfillment information., Retrieve Walmart product type definitions, attribute schemas, and item classification rules used when setting up seller listings.

Pod Owner: Pod 1 — Items & Catalog Implementation target: Walmart Item Classification Service, Create, cancel, and retrieve seller reports. Supports scheduled and on-demand reports with async processing.

Pod Owner: Pod 4 — Feeds & Reports Implementation target: Walmart Seller Reporting Service, Walmart Seller API contract for sales metrics., Walmart Seller API contract for messaging., Walmart Seller API contract for notifications., Walmart Seller API contract for solicitations., Retrieve information about a seller's Walmart Marketplace account and marketplace participations.

Pod Owner: Pod 5 — Seller & Finances Implementation target: Walmart Seller Account Service / Seller Center, Shipping API for sellers to request rates, purchase shipping labels, track shipments, and manage delivery exceptions across Walmart Marketplace and WFS channels.

Surface aligned with industry SP-API Shipping v2. Pod 2 — Orders & Fulfillment owns this service. Common types (Address, Money, Weight, PackageDimensions) are inlined per Pod 2 convention, byte-identical to the canonical copies in the Merchant Fulfillment API; (proposed) defines the future promotion path to models/_shared/ once the Rule of Three triggers a coordinated extraction PR., Shipping Management API for sellers to manage supply sources (fulfillment centers / ship nodes). This service acts as a facade over Aurora Fulfilment Services (AFS), applying field renaming and response shaping for the WSA v4 contract., Create upload destinations (pre-signed URLs) for feed documents and retrieve previously uploaded documents. Used in conjunction with the Feeds service for async bulk operations.

Pre-signed URLs must not appear in logs — treat as secrets.

Pod Owner: Pod 4 — Feeds & Reports Implementation target: Walmart Document Store / S3 pre-signed URLs


Installation

To add the .NET SDK to your project from NuGet:

dotnet add package WmV4ApisSDK

To build against the SDK source instead, add it as a project reference into your solution:

dotnet add reference <path-to-sdk>/src/WalmartApIs/WalmartApIs.csproj

The project takes its build settings from the files around it, so reference it in place. Building from source needs the .NET 10 SDK (C# 14).

The package holds two builds. A .NET 10 or later application gets the net10.0 build, which depends on Microsoft.Bcl.AsyncInterfaces, Microsoft.Bcl.TimeProvider, Microsoft.Extensions.Http and Microsoft.Extensions.Logging.Abstractions. Every other runtime gets the netstandard2.0 build, among them .NET Framework 4.6.2 and later and .NET 8 and 9. Both builds have the same public API, and a library built against one build runs against the other: a .NET Standard 2.0 library that uses the SDK works in a .NET 10 application.

On .NET Framework:

  • The SDK writes a number such as 99.99 as 99.99 in bodies, query values and headers. If you serialize an SDK model yourself, System.Text.Json writes 17 digits there (99.989999999999995). The value is the same; only the text is longer.

The assembly embeds its PDB, so stack traces carry SDK file and line numbers.


Building from source

dotnet pack src/WalmartApIs/WalmartApIs.csproj -c Release

Release packs come from CI, where CI=true makes the build deterministic; to reproduce that locally add -p:ContinuousIntegrationBuild=true.

The generator never emits Directory.Build.targets, so a customer-owned one at the repo root is MSBuild's auto-imported customization seam. It imports after the props and the project body into every project under the root, so put SDK-only settings under <PropertyGroup Condition="'$(MSBuildProjectName)' == 'WalmartApIs'">.

It overrides every property the SDK reads when targets run (package metadata, Version, AssemblyVersion, compiler warnings, package references, which under central package management use VersionOverride). It cannot change values the SDK derives earlier: TargetFramework(s), AssemblyName and output paths stay generator settings; turning off GenerateDocumentationFile also needs <DocumentationFile />; a ContinuousIntegrationBuild set there also needs <DeterministicSourcePaths>true</DeterministicSourcePaths>.

The SDK's props files are a boundary: a parent repository's Directory.Build.props does not apply, while a parent Directory.Build.targets does.

APIMatic's delivery tools do not yet preserve Directory.Build.targets across regeneration — list it in .codegenignore when publishing to GitHub.


Quick Start

Dependency Injection

Register the client with IServiceCollection and resolve it from the container. Configure the client's behavior through WalmartApIsClientOptions.

services.AddWalmartApIsClient(options =>
{
    options.SellerAuthAuthorizationCode =
        new OAuth2AuthorizationCodeCredentials
        {
            ClientId = "YOUR_CLIENT_ID",
            RedirectUri = "YOUR_REDIRECT_URI",
            PromptForAuthorizationCode = (authUrl, ct) => Task.FromResult(""),
        };
    options.SellerAuthClientCredentials =
        new OAuth2ClientCredentials { ClientId = "YOUR_CLIENT_ID", ClientSecret = "YOUR_CLIENT_SECRET" };
    options.BasicClientAuth = new BasicAuthCredentials { Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" };
    options.WalletAuth =
        new OAuth2ClientCredentials { ClientId = "YOUR_CLIENT_ID", ClientSecret = "YOUR_CLIENT_SECRET" };
    options.Environment = ServerEnvironment.Production;
    // TODO: configure more client options here
});

AddWalmartApIsClient registers the client as a singleton over its own named IHttpClientFactory client and returns that registration's IHttpClientBuilder. Chain any IHttpClientBuilder extension onto it to customize the SDK's transport — handlers, proxies, client certificates — without touching the HttpClient any other part of your application uses. The client keeps its handler for the process lifetime, so refresh pooled connections there if your API's DNS changes:

services.AddWalmartApIsClient(options =>
{
    // TODO: configure the client options as above
})
    .ConfigurePrimaryHttpMessageHandler(() => new SocketsHttpHandler
    {
        PooledConnectionLifetime = TimeSpan.FromMinutes(5),
    });

The named client has no timeout of its own: AddWalmartApIsClient sets its HttpClient.Timeout to Timeout.InfiniteTimeSpan, so WalmartApIsClientOptions.Timeout is the only one. If you do want a transport timeout, chain .ConfigureHttpClient(client => client.Timeout = …) onto the returned builder.

Note: the SDK applies its own retry policy. If you add a resilience handler such as AddStandardResilienceHandler(), disable the SDK's retries with options.Retry = RetryOptions.Disabled() so attempts don't multiply.

Direct Instantiation

Create the client by passing an HttpClient you manage yourself. Configure the client's behavior through WalmartApIsClientOptions.

var httpClient = new HttpClient { Timeout = Timeout.InfiniteTimeSpan };
// TODO: configure more client options here
var options = new WalmartApIsClientOptions
{
    SellerAuthAuthorizationCode = new OAuth2AuthorizationCodeCredentials
    {
        ClientId = "YOUR_CLIENT_ID",
        RedirectUri = "YOUR_REDIRECT_URI",
        PromptForAuthorizationCode = (authUrl, ct) => Task.FromResult(""),
    },
    SellerAuthClientCredentials = new OAuth2ClientCredentials
    {
        ClientId = "YOUR_CLIENT_ID",
        ClientSecret = "YOUR_CLIENT_SECRET",
    },
    BasicClientAuth = new BasicAuthCredentials { Username = "YOUR_USERNAME", Password = "YOUR_PASSWORD" },
    WalletAuth = new OAuth2ClientCredentials { ClientId = "YOUR_CLIENT_ID", ClientSecret = "YOUR_CLIENT_SECRET" },
    Environment = ServerEnvironment.Production,
};
var client = new WalmartApIsClient(httpClient, options);

First Call

Whichever way you created it, call an operation on the client and await it; with dependency injection, take WalmartApIsClient as a constructor parameter. The API reference has a sample for every operation.

var response = await client.Catalog.GetCatalogItem(new GetCatalogItemRequest
{
    WalmartItemId = "00000000000000",
    MarketplaceIds = ["some example string"],
});
// TODO: Handle 'response' of type Item

Credentials, tokens and 401s

Every credential is an option on WalmartApIsClientOptions. A static credential can also come from a provider that is asked on every request, so a rotated secret reaches the next call without rebuilding the client:

var options = new WalmartApIsClientOptions
{
    BasicClientAuthProvider = async ct => new BasicAuthCredentials
    {
        Username = "YOUR_USERNAME",
        Password = await vault.ReadAsync("api-password", ct),
    },
};

OAuth2 credentials (OAuth2AuthorizationCodeCredentials, OAuth2ClientCredentials) are exchanged for a token the SDK caches and renews before it expires. With client credentials, an operation that declares scopes gets its own token per scope set, requested with exactly those scopes; operations that declare none share one token requested without a scope. The authorization-code grant holds one token and requests every scope its flow declares, so one consent covers every operation; it keeps the refresh token the server issues and uses it to renew silently. Setting Scope on the credentials replaces that with one token requested with that value, and an empty Scope requests none. Set it to the scopes your client is registered for whenever the API declares more than it grants you: the default asks for the whole catalogue, and an authorization server that enforces per-client scope registration answers invalid_scope to that request.

When a server answers 401 Unauthorized:

  • An OAuth2-authenticated call drops the rejected token, obtains a new one and is sent again, once and without a delay, under every retry setting including RetryOptions.Disabled() and a per-request MaxRetries of 0. It does not count as one of your retries. Retries already used before the 401 stay used and the delay keeps growing, so one call sends at most MaxRetries + 2 requests. It is logged as its own warning, re-authenticating after 401 Unauthorized (event 1008), not as a retry. A second 401 is returned to you.
  • A call with a static credential (bearer token, API key, basic auth) is not retried; a provider, if you set one, is asked again on the next call, not on this one. A throwing operation raises ApiException with StatusCode 401.

A request whose body cannot be re-sent (a stream upload) is never retried either, but its 401 still drops the cached token, so the next call recovers. A hook that replaces the Authorization header makes the token comparison miss; the one retry still happens.

Required and optional auth

An operation sends only the credentials its API declares. If a required credential is not configured, the call fails before anything is sent with an AuthSchemeException that names the scheme (… requires the SellerAuthAuthorizationCode scheme, which is not configured.). Only an operation whose API allows anonymous callers (an empty security requirement in the spec) is sent without credentials, and only when no whole alternative is configured (every credential in an AND group); a configured alternative is sent, and a provider that returns nothing fails the call. A credential that is set but blank is treated as configured and sent as-is: the SDK checks presence, never content.

Credentials from environment variables

Any credential option left null is read from an environment variable when the client is constructed. The variable name is the SDK name and the option's name, each in upper snake case, plus the member name for multi-member credentials:

Option Environment variables
SellerAuthClientCredentials WALMART_AP_IS_SELLER_AUTH_CLIENT_CREDENTIALS_CLIENT_ID, WALMART_AP_IS_SELLER_AUTH_CLIENT_CREDENTIALS_CLIENT_SECRET, WALMART_AP_IS_SELLER_AUTH_CLIENT_CREDENTIALS_SCOPE (optional)
BasicClientAuth WALMART_AP_IS_BASIC_CLIENT_AUTH_USERNAME, WALMART_AP_IS_BASIC_CLIENT_AUTH_PASSWORD
WalletAuth WALMART_AP_IS_WALLET_AUTH_CLIENT_ID, WALMART_AP_IS_WALLET_AUTH_CLIENT_SECRET, WALMART_AP_IS_WALLET_AUTH_SCOPE (optional)
logging WALMART_AP_IS_LOG = info, debug or trace (read only when no ILoggerFactory is set; AddWalmartApIsClient always supplies the container's)

SellerAuthAuthorizationCode has no environment default.

Rules:

  • A value set in code always wins over the environment, including the placeholder assignments in the Quick Start samples; delete the line for any credential you supply through an environment variable.
  • A variable that is unset, empty or whitespace counts as not configured.
  • A multi-member credential is used only when every required variable is set. If some are missing the option stays null; constructing the client never throws, and a call that requires that credential fails before anything is sent (see "Required and optional auth").
  • Variables are read once, when the client is constructed. Changing them afterwards has no effect on an existing client.

Hosted applications that already use the .NET options pattern can bind the whole options object from IConfiguration instead, which picks up environment variables through the configuration provider (WalmartApIs__SellerAuthAuthorizationCode__ClientId, and so on):

services.AddWalmartApIsClient(options => configuration.GetSection("WalmartApIs").Bind(options));

Both paths coexist: a slot the bound configuration leaves null still falls back to its environment variable.


Usage

For code examples and error responses, see API Reference.

Enums

Every enum the spec declares is a sealed class with one public static readonly member per value (CompressionAlgorithm.Gzip), a JSON converter, and a Match that makes handling exhaustive: one on{Member} arm per known value, then otherwise, which receives the raw wire value the server sent when it is one this SDK does not declare.

var label = received.Match(onGzip: () => "Gzip", otherwise: raw => $"undeclared ({raw})");

Prefer named arguments as above. The arms are positional, in the order the spec lists its values, and a regenerated SDK that adds or moves a value changes the Match signature: a positional call site compiled against the old shape either stops compiling or, if the assembly is not rebuilt, throws MissingMethodException at the first call, and a reordered value can rebind a positional argument to a different member without any diagnostic. Treat an added or moved enum value as a breaking change of that enum. Code that must survive regeneration untouched compares instead of matching: received == CompressionAlgorithm.Gzip or received.Is(rawValue) against a raw wire value; neither reopens construction.

A value the SDK does not declare still round-trips: IsKnownValue() tells you whether it is one of the generated members, and sending the instance back echoes the server's own casing. You cannot construct an undeclared value yourself — there is no public factory — so a typo cannot compile; resolve a raw value with CompressionAlgorithm.TryGetKnownValue("GZIP", out var known).

A spec value whose name would collide with the enum's own name, with a member every enum inherits or generates (such as Value, Match or IsKnownValue), or with a member of object takes a Member suffix — a value value becomes ValueMember — and the other members keep their plain names.

SDK map

This SDK ships a generated SDK map — sdk-map.md plus the map/ pages — a deterministic, lookup-oriented table of contents of the SDK's C# surface, generated by APIMatic alongside this SDK.

Read it before scanning the source. Whether you are an AI coding assistant or searching by hand, the map answers "what is the exact …" by lookup for every call-level contract, and for anything it does not carry it names the one file that does — so you never have to search the source tree:

  • sdk-map.md — the index: client construction, servers/auth, the options/retry reference, the SDK-wide defaults the operation rows rely on, and link tables into map/.
  • map/operations/ — one page per controller: the exact C# signature, the return type, the error type with its typed TryGet… accessors, and pagination — plus, per operation, a Type sources table naming the file that declares every type that operation mentions.

Model shapes — record fields with their JSON wire names, enum member names and wire values, OneOf/AnyOf union variants — are not duplicated in the map. Take the path from the operation's Type sources table and read the declaring file; it is the single source of truth and cannot go stale against the code.

Each operation row states what is specific to that operation. The SDK-wide defaults are stated once in sdk-map.md — throw-only (no Result-style no-throw variants), no pagination, the four fixed RawError accessors, the Default server group — and a row appears only where its operation departs from one. A row silent on pagination is telling you that operation has none.

The HTTP verb and route, and the endpoint's behavioural prose, live on the operation itself, in the source file named at the top of its operations page. Read them there when something needs them — wiring a mock, reading a provider log, or settling a rule about what you must pass.

Workflow: look the fact up in the map → where the map leaves something ambiguous, open the one source file the row names → the compiler is the backstop (a name that isn't in the map won't build). Don't scan or grep the tree to find things — the map is the locator.

Which one to reach for

The map and the API Reference answer different questions, and the map is generated from this SDK's source so it stays in lockstep with the code it describes.

Use For
sdk-map.md + map/ Traversing the SDK and working out its surface — locating the operation you need (this SDK exposes 184 operations), its exact signature and request record, the shape and JSON wire names of the models it takes and returns, which error type it throws and how to read it, and the source file behind any of it. This is the index to consume the SDK from, and the one to reach for first.
api-reference.md Usage guidance for a single operation once you know which one you want — a runnable code sample, a link to its request record, and the error responses it can return.

Retries and Timeouts

The SDK retries a failed request itself, with backoff, and bounds every attempt with a timeout. Both are set on WalmartApIsClientOptions:

Option Default Meaning
Timeout 100 s Time each attempt may take to receive the response, not the time for the whole call
StreamReadTimeout 60 s Longest wait between two events of a Server-Sent Events stream
Retry.MaxRetries 3 Retries after the first attempt
Retry.Delay 1 s Wait before the first retry
Retry.BackoffFactor 2 Each wait is the previous one multiplied by this; 1 keeps it constant
Retry.MaxJitter 500 ms Upper bound of the random time added to each wait
Retry.StatusCodesToRetry 408, 425, 429, 500, 502, 503, 504 The statuses that are retried
Retry.IdempotentMethods GET, HEAD, PUT, DELETE, OPTIONS The methods that are safe to repeat
var options = new WalmartApIsClientOptions
{
    Timeout = TimeSpan.FromSeconds(30),
    Retry = new RetryOptions { MaxRetries = 5, Delay = TimeSpan.FromSeconds(2) },
};

What is retried:

  • Only a status in StatusCodesToRetry is retried. With an empty list no status is retried.
  • 408, 425, 429 and 503 are retried on every method, POST included. With these statuses the server says it did not process the request.
  • Every other status in the list, a network failure and a timed-out attempt are retried only on a method in IdempotentMethods, because the server may already have acted. The SDK sends an Idempotency-Key header with every non-GET call, a fresh value per call unless the operation's request record carries that header; if your API honours it, add HttpMethod.Post and HttpMethod.Patch to IdempotentMethods.
  • A request whose body cannot be sent twice (a file or stream upload) is never retried.
  • A 401 on an OAuth2-authenticated call is sent again once with a new token and does not count as a retry (see Credentials, tokens and 401s).

Before retry n the SDK waits Delay × BackoffFactor^(n−1) plus the jitter, and never more than one minute. When the response carries a Retry-After header with a positive value, the SDK waits that long instead, again capped at one minute.

RetryOptions.Disabled() turns retries off. A negative MaxRetries, Delay or MaxJitter, or a BackoffFactor below 1, throws ArgumentOutOfRangeException when the client is constructed.

Timeouts:

  • Timeout applies to each attempt, so a call with three retries can take up to four timeouts plus the waits between them, and one more when an OAuth2 call is also sent again after a 401. A timed-out attempt on an idempotent method is retried; when no retry is left, the call throws SdkTimeoutException.
  • The clock of an attempt starts when the request is sent and stops when the whole response has been received, body included. A response that stalls part-way is a timed-out attempt, and one that breaks off part-way is a network failure; both are retried like any other. Set Timeout long enough for the largest response you expect.
  • A file download and a Server-Sent Events stream are handed to you while they arrive, so for them the clock stops when the response headers arrive; an error response is still received in full. After that, StreamReadTimeout bounds the wait for each event of a stream, and cancelling your CancellationToken ends the stream and releases its connection. A download's stream is yours to read, and no timeout applies to it: dispose the BinaryContent to abandon a read that hangs.
  • Getting a credential (an OAuth2 token request, a credential provider) and your hooks run outside that window. They are not timed, so a slow provider or hook is never reported as a timeout. Pass a CancellationToken to the call if one of them can hang.
  • Timeout.InfiniteTimeSpan removes the limit, for Timeout and for StreamReadTimeout. Zero or a negative value throws ArgumentOutOfRangeException when the client is constructed.
  • The HttpClient.Timeout of a client you construct yourself still applies and cuts an attempt short when it is the shorter of the two, so set it to Timeout.InfiniteTimeSpan as the Quick Start does; AddWalmartApIsClient does that for its own client. When it does elapse, it is reported as SdkTimeoutException and the attempt is retried like any other timeout.
  • A timeout set on the handler, such as SocketsHttpHandler.ConnectTimeout, is reported as SdkConnectionException and retried like any other network failure when HttpClient.Timeout is infinite. Under a finite HttpClient.Timeout the runtime does not tell the two apart, so it is reported as SdkTimeoutException naming HttpClient.Timeout.

Per-request options

Every operation takes an optional RequestOptions, after its request record when it has one. It changes these settings for that one call:

Property Effect on the call
Timeout Replaces WalmartApIsClientOptions.Timeout for each attempt
MaxRetries Replaces Retry.MaxRetries
Headers Adds or replaces request headers; a null value removes a header
LogLevel Sets the level of the SDK's log lines for this call, in place of the client's header and body switches: a higher level suppresses lines, Debug adds the headers and Trace adds the request body, even when the client's Logging options leave them off
Hooks Hooks that run after the client-wide ones
using WalmartApIs.Core;

var requestOptions = new RequestOptions { Timeout = TimeSpan.FromSeconds(10), MaxRetries = 0 };
  • Pass it as the requestOptions argument. A property left null uses the client's value.
  • MaxRetries may be higher than the client's value and works on a client built with RetryOptions.Disabled(). It never makes an upload that cannot be sent twice retry, and the 401 re-send does not count against it.
  • Timeout is per attempt, like the client's, and Timeout.InfiniteTimeSpan removes the limit for the call. A value longer than the HttpClient.Timeout of a client you constructed yourself is still cut by that client.
  • A zero or negative Timeout, or a negative MaxRetries, throws ArgumentOutOfRangeException from the call, before anything is sent.
  • On a paginated operation the options apply to every page request.
  • An OAuth2 token request that the call triggers is a request of its own. It keeps the client's MaxRetries and the client's Timeout, and the per-request values do not apply to it. If the token endpoint does not answer in that time, the call fails with AuthSchemeException and the operation is not sent.

Observing retries

The SDK logs each retry as a warning before the wait starts, as event 1006 (HttpRetrying):

HTTP GET … retrying in 00:00:01.2140000 (retry 1/3): 503 ServiceUnavailable
  • The entry carries Method, Url, Delay, Retry, MaxRetries and Reason as structured values. Reason is the status, or the exception type for a network failure or a timeout (SdkConnectionException, SdkTimeoutException), in which case the exception is attached to the entry.
  • The 401 re-send is not a retry and logs its own warning, event 1008.
  • Hooks run for every attempt, so SdkHook.OnRequest sees each request that is sent again and SdkHook.OnResponse each response that led to a retry.
  • There is no retry callback: RetryOptions holds only settings.

Error Handling

Operations throw when the server answers with an error status. TError is the operation's error type from the spec — RawError (the status code plus the raw body) when the spec declares none.

using WalmartApIs.Core.Exceptions;          // the exception family
using WalmartApIs.Errors;                   // generated error types such as CreateTokenError
using WalmartApIs.Requests.Authorization;   // request records such as CreateTokenRequest
using WalmartApIs.Models.Enums;             // models such as GrantType

try
{
    var response = await client.Authorization.CreateToken(new CreateTokenRequest
    {
        GrantType = GrantType.ClientCredentials,
    });
}
catch (ApiException<CreateTokenError> ex)
{
    // "POST <server>/v4/auth/token returned 400 (BadRequest)."
    Console.Error.WriteLine(ex.Message);
    if (ex.Error.TryGetOAuthError(out var oAuthError))
    {
        // TODO: handle 'oAuthError' of type OAuthError
    }
}

Match on an error type is exhaustive: one on{Arm} arm per body the operation declares, each receiving the parsed body, and a last otherwise arm that receives the RawError (status code plus raw body) of a status the operation does not declare, such as a gateway's 502. An arm is a body, not a status: statuses that share a body share an arm, and the status itself is on result.StatusCode or ex.StatusCode. TryGet{Arm} reads one arm when that is all you need, as in the catch above; TryGetRawError is the accessor behind otherwise.

Prefer named arguments, as with enums and unions: the arms are positional, in the order of their names, and a regenerated SDK whose operation gains or loses an error body changes the Match signature — a positional call site stops compiling or, if the assembly is not rebuilt, throws MissingMethodException at the first call. Treat an added or removed error body as a breaking change of that error type. A status added for a body the operation already declares changes nothing. Code that must survive regeneration untouched uses the TryGet{Arm} accessors instead.

Everything the SDK raises for a call derives from SdkException, which carries the failed call's Method and RequestUri. Every message starts with that call, and the underlying cause is always InnerException.

Exception When Extra members
ApiException<TError> The server answered with an error status Error, plus StatusCode, Headers and ContentType from ApiException
ResponseDeserializationException A response body did not match the type the spec declares TargetType, plus the ApiException members
SdkConnectionException The request could not be sent, or the connection failed before the whole response was received
SdkTimeoutException An attempt, the transport, or a Server-Sent Events stream went silent (derives from SdkConnectionException) Timeout
AuthSchemeException A required credential is not configured, a provider returned nothing, or a credential could not be applied — for example the OAuth2 token endpoint refused it or did not answer SchemeFailures

Catch from specific to general: ApiException means the server answered, SdkConnectionException means it did not, and SdkException is everything the SDK raises. Your own cancellation surfaces as the usual OperationCanceledException, never wrapped.


Best Practices

Use a single WalmartApIsClient instance for the lifetime of your application and reuse it across all requests. Creating a new instance per request might exhaust the connection pool.

Let the SDK own timeouts. WalmartApIsClientOptions.Timeout bounds each attempt (default 100 s), and a timed-out attempt is retried under the retry policy before it surfaces as SdkTimeoutException. When you construct the HttpClient yourself, set its Timeout to Timeout.InfiniteTimeSpan (or comfortably above the SDK's) so the transport does not race the SDK; AddWalmartApIsClient does that for its own client. See Retries and Timeouts.

The SDK reads time only through WalmartApIsClientOptions.TimeProvider (default TimeProvider.System): retry backoff, Retry-After, the SSE idle timeout, OAuth2 token expiry and the logged request durations all follow it. Under AddWalmartApIsClient a TimeProvider registered in the container is picked up automatically, and setting the option explicitly wins. To fake time in your own tests use a provider that implements timers, such as FakeTimeProvider from Microsoft.Extensions.TimeProvider.Testing, so retries and idle timeouts advance with it.

License

This SDK is distributed under the MIT License.


Support

Refer to the API reference for detailed information on available operations with code samples.

For further assistance, please contact support at pod-0@sellers.walmart.com.


Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 0 12/3/2026
0.0.1 95 10/27/2026