Code Monkey home page Code Monkey logo

flipkart-seller-api-java-sdk's Introduction

Flipkart Seller API Java SDK.

flipkart


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

Building the API client library requires:

  1. Java 1.8+
  2. 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:

  1. First, create file MyFlipkartApplication.java in your workspace.

  2. Select the Environment (SANDBOX or PROD)

    String env = String.valueOf(Environment.SANDBOX);
  3. 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__");
    
  4. 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);
    
  5. Create an ApiClient object with proper configurations.

    ApiClient apiClient = new ApiClient();
    apiClient.setAccessToken(accessToken);
    
  6. 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();
     }
    
    
  7. Here, you can find a sample code snippet for all the flipkart seller api's Documentation for API Endpoints

  8. 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

Documentation for Authorization

Authentication schemes defined for the API:

Oauth2SelfAccess

Oauth2ThirdParty

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

flipkart-seller-api-java-sdk's People

Contributors

ramameghanadaliparthi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.