Flipkart Seller API Java SDK.
This repository contains Flipkart Seller API Java SDK and samples to invoke Endpoints.
Flipkart Marketplace API
- API version: 3.0
This API is offered by Flipkart Marketplace to sellers and partners for orders and listing management.
You will need an access token to explore our APIs in both sandbox and prod environment. For details on getting an access token, refer to the documentation.
Table of contents
- Requirements
- Installation
- Getting Started
- Sample Example For Sandbox Environmnet
- Sample Example For Prod Environment
- Documentation for API Endpoints
- Documentation for Models
- Documentation for Authorization
- Recommendation
- Author
Requirements
Building the API client library requires:
- Java 1.8+
- Maven/Gradle
Installation
To install the API client library to your local Maven repository, simply execute:
mvn clean install
Maven users
Add this dependency to your project's POM:
<dependency>
<groupId>com.flipkart.api.seller</groupId>
<artifactId>flipkart-seller-api-java-sdk</artifactId>
<version>0.1.0</version>
<scope>compile</scope>
</dependency>
Gradle users
Add this dependency to your project's build file:
repositories {
mavenLocal()
}
dependencies {
compile "com.flipkart.api.seller:flipkart-seller-api-java-sdk:0.1.0"
}
Others
At first generate the JAR by executing:
mvn clean package
Then manually install the following JARs:
target/flipkart-seller-api-client-0.1.0-SNAPSHOT.jar
target/lib/*.jar
Getting Started
Please follow the installation instruction and execute the following Java code:
-
First, create file MyFlipkartApplication.java in your workspace.
-
Select the Environment (SANDBOX or PROD)
String env = String.valueOf(Environment.SANDBOX);
-
If it is Self Access, you can directly specify env
UrlConfiguration urlConfiguration = new UrlConfiguration(env);
If it is Third Party Access, you have to specify env, redirect_url, state and authorization_code. For more details please refer Authorization Code Flow
UrlConfiguration urlConfiguration = new UrlConfiguration(env,"__redirectUrl__", "__state__", "__authCode__");
-
Fetch the client id and client secret from Seller API's - Developer Admin
Sandbox Environment
For Both Self and Third Party Access
Production Environment
For Self Access
For Third Party Access
//Replace the below values with your client id and secret accessTokenGenerator.clientCredentials("2236b321b07115458a50a701216b03229194","1e90ba1dc37ace3e658281c70ff215aac"); String accessToken = AccessTokenGenerator.getClientCredentialsAccessToken(); System.out.println("Your Access Token: " + accessToken);
-
Create an ApiClient object with proper configurations.
ApiClient apiClient = new ApiClient(); apiClient.setAccessToken(accessToken);
-
Make API Calls.
//Sample API Call ListingsCommonV3Api apiInstance = new ListingsCommonV3Api(apiClient); String skuIds = "__sku_id__"; // String | sku-ids try { GetMarketplaceListingDetailsResponse result = apiInstance.getListings(skuIds); System.out.println(result); } catch (ApiException e) { System.err.println("Exception when calling ListingsCommonV3Api#getListings"); System.err.println("Status code: " + e.getCode()); System.err.println("Reason: " + e.getResponseBody()); System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); }
-
Here, you can find a sample code snippet for all the flipkart seller api's Documentation for API Endpoints
-
Run the code using IDE.
Sample Example For Sandbox Environment
package com.flipkart.api.seller.client.client_application;
import com.flipkart.api.seller.client.ApiClient;
import com.flipkart.api.seller.client.ApiException;
import com.flipkart.api.seller.client.Environment;
import com.flipkart.api.seller.client.UrlConfiguration;
import com.flipkart.api.seller.client.access_token_generation.AccessTokenGenerator;
import com.flipkart.api.seller.client.api.ShipmentV3Api;
import com.flipkart.api.seller.client.model.ShipmentResponse;
import java.util.ArrayList;
public class MyFlipkartApplication {
public static void main(String[] args) {
//Access Token Generation
AccessTokenGenerator accessTokenGenerator= new AccessTokenGenerator();
//choose environment SANDBOX or PROD
String env = String.valueOf(Environment.SANDBOX);
//For Self Access
UrlConfiguration urlConfiguration = new UrlConfiguration(env);
//For Third Party
UrlConfiguration urlConfiguration = new UrlConfiguration(env,"__redirectUrl__", "__state__", "__authCode__");
//Replace the below values with client id and client secret here
accessTokenGenerator.clientCredentials("__Client_ID__","__Client_Secret__");
String accessToken = AccessTokenGenerator.getClientCredentialsAccessToken();
System.out.println("Your Access Token: " + accessToken);
//client call
ApiClient apiClient = new ApiClient();
apiClient.setAccessToken(accessToken);
//End Point Invocation
ListingsCommonV3Api apiInstance = new ListingsCommonV3Api(apiClient);
String skuIds = "__sku_id__"; // String | sku-ids
try {
GetMarketplaceListingDetailsResponse result = apiInstance.getListings(skuIds);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ListingsCommonV3Api#getListings");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Sample Example For PROD Environment
package com.flipkart.api.seller.client.client_application;
import com.flipkart.api.seller.client.ApiClient;
import com.flipkart.api.seller.client.ApiException;
import com.flipkart.api.seller.client.Environment;
import com.flipkart.api.seller.client.UrlConfiguration;
import com.flipkart.api.seller.client.access_token_generation.AccessTokenGenerator;
import com.flipkart.api.seller.client.api.ShipmentV3Api;
import com.flipkart.api.seller.client.model.ShipmentResponse;
import java.util.ArrayList;
public class MyFlipkartApplication {
public static void main(String[] args) {
//Access Token Generation
AccessTokenGenerator accessTokenGenerator= new AccessTokenGenerator();
//choose environment SANDBOX or PROD
String env = String.valueOf(Environment.PROD);
//For Self Access
UrlConfiguration urlConfiguration = new UrlConfiguration(env);
//For Third Party
UrlConfiguration urlConfiguration = new UrlConfiguration(env,"__redirectUrl__", "__state__", "__authCode__");
//Replace the below values with client id and client secret here
accessTokenGenerator.clientCredentials("__Client_ID__","__Client_Secret__");
String accessToken = AccessTokenGenerator.getClientCredentialsAccessToken();
System.out.println("Your Access Token: " + accessToken);
//client call
ApiClient apiClient = new ApiClient();
apiClient.setAccessToken(accessToken);
//End Point Invocation
ListingsCommonV3Api apiInstance = new ListingsCommonV3Api(apiClient);
String skuIds = "__sku_id__"; // String | sku-ids
try {
GetMarketplaceListingDetailsResponse result = apiInstance.getListings(skuIds);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ListingsCommonV3Api#getListings");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Documentation for API Endpoints
All URIs are relative to https://sandbox-api.flipkart.net/sellers , https://api.flipkart.net/sellers
Class | Method | HTTP request | Description |
---|---|---|---|
ListingsCommonV3Api | getListings | GET /listings/v3/{skuIds} | Get listings for SKUs |
ListingsCommonV3Api | updateInventory | POST /listings/v3/update/inventory | Update listing inventory request |
ListingsCommonV3Api | updatePrice | POST /listings/v3/update/price | Update listing price request |
ListingsFlipkartV3Api | createListings | POST /listings/v3 | Create listing request |
ListingsFlipkartV3Api | updateListings | POST /listings/v3/update | Update listing request |
ListingsHyperlocalV3Api | createListings | POST /listings/v3/hyperlocal | Create listing request |
ListingsHyperlocalV3Api | updateListings | POST /listings/v3/hyperlocal/update | Update listing request |
OrdersV2Api | cancelOrders | POST /v2/orders/cancel | Cancel order items |
OrdersV2Api | getBulkActionProgressByRequestId | GET /v2/orders/labelRequest/{requestId} | Check label generation status |
OrdersV2Api | getInvoicesInfo | GET /v2/orders/invoices | Get invoice details for order items |
OrdersV2Api | getLabels | GET /v2/orders/labels | Download labels and invoices in PDF format for order items |
OrdersV2Api | getManifestPdfForRequest | GET /v2/orders/manifest | Download manifest PDF |
OrdersV2Api | getOrderItemById | GET /v2/orders/{order_item_id} | Get details of order item |
OrdersV2Api | getOrderItemsByIds | GET /v2/orders | Get details of order items |
OrdersV2Api | getShipments | GET /v2/orders/shipments | Get shipping related details of order items |
OrdersV2Api | searchOrderItemRequest | POST /v2/orders/search | Search order items using filters |
OrdersV2Api | submitBulkConfirmRequest | POST /v2/orders/labels | Trigger label generation for order items |
OrdersV2Api | submitBulkRtdRequest | POST /v2/orders/dispatch | Mark order items ready for dispatch |
OrdersV2Api | submitSelfShipDeliverAttemptRequest | POST /v2/shipments/deliveryAttempt | Update delivery attempt for self-ship order items |
OrdersV2Api | submitSelfShipDeliverRequest | POST /v2/shipments/delivery | Update delivery date for self-ship order items |
OrdersV2Api | submitSelfShipmentDispatchRequest | POST /v2/shipments/dispatch | Mark self-ship order items ready for dispatch |
OrdersV2Api | submitServiceAttemptRequest | POST /v2/services/attempt | Update service attempts |
OrdersV2Api | submitServiceCompleteRequest | POST /v2/services/complete | Update services as complete |
ReturnsV2Api | approveSelfShipReturns | POST /v2/returns/approve | Approve self-ship returns |
ReturnsV2Api | cancelSelfShipReturn | POST /v2/returns/cancel | Cancel self-ship return |
ReturnsV2Api | getReturns | GET /v2/returns | Fetch returns |
ReturnsV2Api | pickup | POST /v2/returns/pickup | Update self-ship returns pickup details |
ReturnsV2Api | pickupAttempt | POST /v2/returns/pickupAttempt | Update self-ship returns pickup attempt |
ReturnsV2Api | rejectSelfShipReturns | POST /v2/returns/reject | Reject self-ship returns |
ReturnsV2Api | returnComplete | POST /v2/returns/complete | Update self-ship returns as complete |
ShipmentV3Api | cancelByEnforcedGroupIds | POST /v3/shipments/cancel | Cancel order items in a shipment |
ShipmentV3Api | getInvoicesPdfFromEsi | GET /v3/shipments/{shipmentIds}/invoices | Download invoice PDF |
ShipmentV3Api | getLabels | GET /v3/shipments/{shipmentIds}/labels | Download labels and invoices in PDF format for shipments |
ShipmentV3Api | getLabelsOnly | POST /v3/shipments/{shipmentIds}/labelOnly | Download labels Byte-Stream for shipments |
ShipmentV3Api | getLabelsOnlyPDF | POST /v3/shipments/{shipmentIds}/labelOnly/pdf | Download labels in PDF format for shipments |
ShipmentV3Api | getManifest | POST /v3/shipments/manifest | Download manifest PDF |
ShipmentV3Api | getShipmentDetails | GET /v3/shipments/{shipmentIds} | Get shipping related details for shipments |
ShipmentV3Api | getShipmentDetailsByInternalId | GET /v3/shipments | Get order details for given shipment or order ids |
ShipmentV3Api | getVendorGroupDetails | GET /v3/shipments/handover/counts | Get shipment handover counts per vendor |
ShipmentV3Api | markRTD | POST /v3/shipments/dispatch | Mark shipments ready for dispatch |
ShipmentV3Api | pack | POST /v3/shipments/labels | Trigger label generation for shipments |
ShipmentV3Api | searchPreDispatchShipmentGet | GET /v3/shipments/filter | Search shipments using filters |
ShipmentV3Api | searchPreDispatchShipmentPost | POST /v3/shipments/filter | Search shipments using filters |
ShipmentV3Api | submitSelfShipDeliverAttemptRequest | POST /v3/shipments/selfShip/deliveryAttempt | Update delivery attempt for self-ship shipments |
ShipmentV3Api | submitSelfShipDeliveryRequest | POST /v3/shipments/selfShip/delivery | Update delivery date for self-ship shipments |
ShipmentV3Api | submitSelfShiptDispatchRequest | POST /v3/shipments/selfShip/dispatch | Mark self-ship shipments dispatched |
ShipmentV3Api | updateTrackingInfo | POST /v3/shipments/{shipmentId}/update | Update Tracking Id of the Shipment |
All URIs are relative to https://sandbox-api.flipkart.net/sellers
Class | Method | HTTP request | Description |
---|---|---|---|
SelfServeApi | changeDispatchSlots | POST /orders/sandbox/update_dispatch_slot | Change `dispatch_by_date` and `dispatch_after_date` |
SelfServeApi | createReturn | POST /returns/sandbox/create_returns | Create courier or customer return |
SelfServeApi | createService | POST /v2/shipments/sandbox/create_service/ | Create forward or reverse services for drop ship orders |
SelfServeApi | createTestOrders | POST /orders/sandbox/test_orders | Create test orders |
SelfServeApi | makeOrderUnHold | PUT /orders/sandbox/un_hold | Mark order un hold |
SelfServeApi | markOrderItemDelivered | POST /orders/sandbox/delivered | Mark order item as delivered |
SelfServeApi | markOrderItemPickupComplete | POST /orders/sandbox/pick_up_complete | Mark order item as pick up complete |
SelfServeApi | markOrderItemShipped | POST /orders/sandbox/shipped | Mark order item as shipped |
SelfServeApi | processReturnEvents | POST /returns/sandbox/return_events | Process return events |
SelfServeApi | putOrderOnHold | PUT /orders/sandbox/on_hold | Put order on hold |
Documentation for Models
- Address
- AddressLabel
- AttributeError
- BulkActionProgressResponse
- BulkConfirmItem
- BulkConfirmResponseV2
- BulkConfirmedItem
- BulkOrderItem
- BulkRtdActionRequest
- BulkRtdRequestItemStatus
- BulkRtdResponse
- BuyerDetails
- CancelOrderItemRequest
- CancelRequestV2
- CancelShipment
- CancelShipmentRequest
- ConfirmItemRow
- Courier
- CourierDetails
- CreateCourierReturnRequest
- CreateCourierReturnResponse
- CreateHyperlocalListingRequest
- CreateOrderItem
- CreateOrderItemResponse
- CreateListingRequest
- CreateService
- CreateTestOrdersRequest
- CreateTestOrdersResponse
- Currency
- DateFilter
- DatingLabel
- DeliverRequest
- Dimension
- Dimensions
- DispatchAddress
- DispatchLocation
- DispatchRequest
- DispatchRequestV3
- DispatchShipmentRequest
- Error
- FailedCancellations
- FailureAttributes
- FetchOrderItemsResponse
- Filter
- Form
- Fulfillment
- GenerateLabelRequestItemV2
- GenerateLabelRequestV2
- GetManifestRequest
- GetMarketplaceListingDetailsResponse
- Handling
- InputStream
- Invoice
- InvoiceDetails
- InvoiceDetailsResponseV3
- InvoiceItem
- InvoiceRequest
- InvoicesSearchResponseV2
- ListingChangeResponse
- Location
- MakeOrderUnHold
- MarkOrderItemDelivered
- MarkOrderItemPickupComplete
- MarkOrderItemShipped
- MarketplaceListingDetail
- ModelPackage
- NotionalValue
- OrderItem
- OrderItemCancelResponse
- OrderItems
- Otc
- PackRequest
- Pagination
- Params
- PickUpDate
- Price
- PriceComponent
- PriceComponents
- ProcessReturnEvents
- PutOrderOnHold
- RequestStatus
- ReturnActionResponse
- ReturnApproveRequest
- ReturnItem
- ReturnRejectRequest
- ReturnsActionResponseV2
- ReturnsApproveRequest
- ReturnsRejectRequest
- ReturnsSearchResponseV2
- SearchOrderItemRequest
- SearchOrderItemResponseV2
- SearchShipmentRequest
- SearchShipmentResponse
- SelfShipReturnAttemptPickupRequest
- SelfShipReturnCancellationRequest
- SelfShipReturnCompleteRequest
- SelfShipReturnPickupAttemptRequests
- SelfShipReturnPickupRequest
- SelfShipReturnPickupRequests
- SelfshipDispatchRequestV3
- SellerAddress
- SerialNumber
- Service
- ServiceAttemptRequest
- ServiceCompleteRequest
- ServiceResponseStatusV2
- Shipment
- ShipmentDetails
- ShipmentDetailsResponseV3
- ShippingFees
- ShipmentPackRequest
- ShipmentResponse
- ShipmentResponseStatusV2
- ShipmentSearchResponse
- ShipmentStatusResponse
- ShipmentsDeliverAttemptRequestV2
- ShipmentsDeliverRequestV2
- ShipmentsDeliverResponseV2
- ShipmentsDispatchRequestV2
- ShipmentsDispatchResponseV2
- Sort
- SubItemRequest
- SubShipment
- SubShipments
- Tax
- TaxDetails
- TaxItem
- UpdateHyperlocalListingRequest
- UpdateInventoryRequest
- UpdatePriceRequest
- UpdateListingRequest
- UpdateShipmentRequest
- VendorGroupCodeDetailsResponseV3
Documentation for Authorization
Authentication schemes defined for the API:
Oauth2SelfAccess
- Type: OAuth
- Flow: application
- Generating Access Token: https://seller.flipkart.com/api-docs/FMSAPI.html#generating-access-tokens
- Scopes:
- : Seller_Api
Oauth2ThirdParty
- Type: OAuth
- Flow: accessCode
- Authorization Code flow: https://seller.flipkart.com/api-docs/FMSAPI.html#auth-code-grant-label
- Generating Access Token: https://seller.flipkart.com/api-docs/FMSAPI.html#generating-access-tokens
- Scopes:
- : Seller_Api
Recommendation
It's recommended to create an instance of ApiClient
per thread in a multithreaded environment to avoid any potential issues.