Menu Close
    Hire Us Request Quote Reading List Switch to Dark Mode

    Marketplace Web Services API For Magento 2

    Marketplace Web Services API For Magento 2 is a multi-vendor Marketplace add-on which exposes the Web Services API of Marketplace module with REST API so that marketplace functions can be used by other application like ERP, Mobile application (iOS, Windows, etc).

    Features

    • Standard REST API support found.
    • This module exposes several marketplace resources to web API including create/become sellers, get sellers list, invoice, credit memo, cancel seller orders, landing page data and many more.
    • Admin and customer level authentication for resources.
    • Search criteria for seller list and seller’s order.
    • The consumer can authenticate by any of these methods token, oAuth or session.
    • JSON format return can be used in mobile and ERP devices including OPENERP. we have built world best Openerp Magento Connector.
    • Using this add-on marketplace can be managed very easily from other applications as well.
    • Added Graphql implementation feature as per suggested by Magento 2.3.

    Installation

    Customers will get a zip folder and they have to extract the contents of this zip folder on their system. The extracted folder has an src folder, inside the src folder you have the app folder. You need to transfer this app folder into the Magento2 root directory on the server as shown below.

    After the successful installation, you have to run the command on Magento2 root directory-“php bin/magento setup:upgrade”

    Now run this command into the Magento2 root – “php bin/magento setup:di:compile

    Also, run this command into the Magento2 Root- “php bin/magento setup:static-content:deploy” You can refer the below screenshot.

    After running the commands, you have to flush the cache from Magento2 admin panel by navigating through->System->Cache management as shown below.

    How To Use – Rest API

    Admin API Calls: needs admin Authorization

    Admin has to Integrate admin level access from the back-end i.e. admin panel.

    Note: Click here to know more about how to search using REST API’s.

    Example:

    Where:

    • field is an attribute name.
    • value specifies the value to search for.
    • condition_type can be of the type – lt(less than), ltet(less than or equal). For more details check the above link for reference.

    S.No.

    Methods & Parameters

    Description

    Return Type

    1

    magentohost*1/rest/V1/mpapi/admin/sellers?searchCriteria

    Note: Required Search Criteria

    Request Type : GET

    This is used to get all sellers data.

    JSON

    2

    magentohost*1/rest/V1/mpapi/admin/sellers/:id

    Request Type : GET

    This is used to get sellers by their id.

    JSON

    3

    magentohost*1/rest/V1/mpapi/admin/sellers/:id/product

    Request Type : GET

    This is used to get sellers wise products.

    JSON

    4

    magentohost*1/rest/V1/mpapi/admin/sellers/:id/order?searchCriteria

    Note: Required Search Criteria

    Request Type : GET

    This is used to get sellers wise orders.

    JSON

    5

    magentohost*1/rest/V1/mpapi/admin/sellers/:id/order/sales

    Request Type : GET

    This is used to get sellers wise sales details.

    JSON

    6

    magentohost*1/rest/V1/mpapi/admin/sellers/:id/paytoseller

    Request Type : POST

    Params: {

    seller_pay_reason <string> <reason to pay>,

    entity_id <int> order entity id

    }

    This is used to pay seller his amount after deducting the commission.

    JSON

    7

    magentohost*1/rest/V1/mpapi/admin/sellers/:sellerId/assign method: POST

    post data: {

    productIds <int> product(s) ids %productIds%

    }

    This is used to assign product(s) to seller

    JSON

    8

    magentohost*1/rest/V1/mpapi/admin/sellers/:sellerId/unassign method: POST

    post data: {

    productIds <int> product(s) ids %productIds%

    }

    This is used to unassign product(s) to seller.

    JSON

     

    Seller API Calls: needs customer Authorization

    S.No.

    Methods & Parameters

    Description

    Return Type
    1

    magentohost*1/rest/V1/mpapi/sellers/me

    Request Type : GET

    This is used to get self profile details

    JSON

    2

    magentohost*1/rest/V1/mpapi/sellers/me/product

    Request Type : GET

    This is used to get self product details.

    JSON

    3

    magentohost*1/rest/V1/mpapi/sellers/me/order?searchCriteria

    Note: Required Search Criteria

    Request Type : GET

    This is used to get self order details.

    JSON

    4

    magentohost*1/rest/V1/mpapi/sellers/me/order/sales

    Request Type : GET

    This is used to get self order sales details.

    JSON

    5

    magentohost*1/rest/V1/mpapi/sellers/me/order/:orderId/invoice

    Request Type : POST

    This is used to create invoice for seller order

    JSON

    6

    magentohost*1/rest/V1/mpapi/sellers/me/order/:orderId/invoice/:invoiceId

    Request Type : GET

    This is used to get invoice data.

    JSON

    7

    magentohost*1/rest/V1/mpapi/sellers/me/order/:orderId/cancel

    Request Type : POST

    This is used to cancel the order.

    JSON

    8

    magentohost*1/rest/V1/mpapi/sellers/me/order/:orderId/invoice/:invoiceId/creditmemo

    Request Type : POST

    Params: {

    creditmemo <array> credit memo fields

    example: array(

    creditmemo => array(

    items => array(

    %itemIds1%=> array(qty => %itemQty1%),

    %itemIds2%=>array(qty=>%itemQty2%…)

    …),

    shipping_amount => %shipping_amount%,

    adjustment_positive => %adjustment_positive%,

    adjustment_negative => %adjustment_negative%,

    do_offline => %do_offline%

    )

    )

    }

    This is used to create credit memo for seller order.

    JSON

    9

    magentohost*1/rest/V1/mpapi/sellers/me/order/:orderId/creditmemo/:creditmemoId

    Request Type : GET

    This is used to get credit memo details.

    JSON

    10

    magentohost*1/rest/V1/mpapi/sellers/me/mailtoadmin

    Request Type : POST

    Params: query <string> message %query%,

    subject <string> message subject %subject%

    )

    }

    This is used to ask questions to admin.

    JSON

    11

    magentohost*1/rest/V1/mpapi/sellers/me/mailtoseller

    Request Type : POST

    Params: {

    customer_email <string> valid email %customer_email%,

    customer_name <string> customer name %customer_name%,

    product_id <int> product (optional) %product_id%,

    query <string> message %query%,

    subject <string> message subject %subject%

    )

    }

    This is used to contact seller.

    JSON

    12

    magentohost*1/rest/V1/mpapi/sellers/me/becomepartner

    Request Type : POST

    Params: {

    shop_url <string> store identifier %shop_url%,

    is_seller <int> 1 if want to be seller else 0 %is_seller%

    )

    }

    This is used to request to become partner.

    JSON

    13

    magentohost*1/rest/V1/mpapi/sellers/me/order/:orderId/ship

    method: POST

    post data: {

    tracking_number <string> tracking number of the shipment %tracking_number%,

    carrier <string> name of the shipiing carrier %carrier%

    )

    }

    This is used to request to create shipment.

    JSON

     

    Guest User Accessible resources: no Authorization needed

    S.No.

    Methods & Parameters

    Description

    Return Type
    1

    magentohost*1/rest/V1/mpapi/marketplace

    Request Type : GET

    This returns Marketplace Landing Page details.

    JSON
    2

    magentohost*1/rest/V1/mpapi/sellers?searchCriteria

    Note: Required Search Criteria

    Request Type : POST

    This is used to get all sellers list.

    JSON
    3

    magentohost*1/rest/V1/mpapi/sellers/:id/reviews

    Request Type : GET

    This is used to get reviews of the seller.

    JSON
    4

    magentohost*1/rest/V1/mpapi/sellers/:id/reviews

    method: POST
    post data: {
    feed_price <int> ratings on price
    feed_quality <int> ratings on quality
    feed_value <int> ratings on value
    feed_nickname <string> reviewer nick name
    feed_summary <string> review summary
    feed_review <string> review
    buyer_emai <string> valid buyer email
    buyer_id <int> buyer id

    }
    Note: The value of feed_price, feed_quality and feed_value is any one from 20, 40, 60, 80 and 100
    20 – 1 star
    40 – 2 star
    60 – 3 star
    80 – 4 star
    100 – 5 star

    This is used to make seller review.

    JSON
    5

    magentohost*1/rest/V1/mpapi/sellers/:review_id/review

    Request Type : GET

    This is used to get review details by review id.

    JSON
    6

    magentohost*1/rest/V1/mpapi/sellers/create
    method: POST
    post data:
    {
    “customer”:{
    “email” <string> seller email,
    “firstname” <string> seller firstname,
    “lastname” <string> seller lastname,
    “storeId” <int> store Id,
    “websiteId” <int> website Id
    },
    “is_seller” <int> 1 for customer aggreed to become seller,
    “profileurl” <string> shop url of seller,
    “password” <string> password for seller profile,
    “registered” <int> 0/1 0->new registration 1->already registered now becoming seller
    }

    This is used to create seller

    JSON

    Note: *1 = magento host base url

    Graphql Implementation

    Graphql is a traditional way to expose the data in a more declarative format, basically it is a query language for the API and it has an only single API endpoint that will serve all your data request needs, however, you have to pre-explained all the data that the server can present in a GraphQL schema.

    In additional Graphql allows the client to simplify what exactly data structure they want from the server and helps to resolve the over-fetching or under-fetching of data.

    Graphql introduced in Magento 2.3.0 having Hierarchical, Introspective nature that gives explanatory error information before executing a query.

    How to Use – Graphql

    To add Graphql implementation in Marketplace Web Services API For Magento 2 have to follow below steps

    Step 1 – A client may get your GraphQL query response by installing chrome extension ChromeiQL.

    Note – In order to get more information about GraphQl implementation in Magento2 refer this link or you may read previous blog How to use GraphQL in php.

    Step 2 – To manage all predefined or custom GraphQL queries in Marketplace Web Services API For Magento 2 you have to set endpoint.

    API Resource : magentohost*1/graphql

    Step 3 -Once you have set endpoint you will get all Preset API list under docs->> document explorer->>query section (from the right side of the ChromeiQL extension)

    Step 4 – To access the specific data you need to type queries into left side of the screen, let’s consider an example for marketplaceLangingPage

    After entering the query you have to hit the “play” button then you will see it returns accurate query of of the marketpalce landing page, you could look given screenshot for further reference.

    Now you will get back exactly structured API data and descriptive error message which you wish to display, nothing more and nothing less in form of type and field.

    Guest User Accessible resources: no authorization needed

    S.No.

    Methods & Parameters

    Description

    Return Type
    1

    query {
    marketplaceLangingPage

    }

    This returns Marketplace Landing Page details.

    JSON
    2

    query {
    sellersList(
    filter:{
    entity_id:{
    eq: “1”
    }
    }
    )
    }

    This is used to get all sellers list.

    JSON
    3

    query {
    getSellerReview(id:1 <Seller Id>)

    }

    This is used to get reviews of the seller.

    JSON
    4

    query {
    getSellerReviewDetails(id:1<review id>)

    }

    This is used to get review details by review Id.

    JSON

    Seller API Calls: needs customer Authorization

    API resource : magentohost*1/graphql

    S.No.

    Methods & Parameters

    Description

    Return Type
    1

    query
    {
    sellerSelf

    }

    This is used to get self profile details

    JSON

    2

    query
    {
    sellerSelfProduct

    }

    This is used to get self product details.

    JSON

    3

    query
    {
    sellerOrderList(filter:{
    entity_id:{
    eq: “1”}})

    }

    This is used to get self order details.

    JSON

    4

    query
    {
    sellerOrderSales

    }

    This is used to get self order sales details.

    JSON

    5

    query
    {
    sellerCreateInvoice(orderid:<Int>)

    }

    This is used to create invoice for seller order

    JSON

    6

    query
    {
    sellerGetInvoiceDetails(orderid:<Int>, invoiceid:<Int>)

    }

    This is used to get invoice data.

    JSON

    7

    query
    {
    seller sellerCancelOrder(orderid:<Int>)

    }

    This is used to cancel the order.

    JSON

    8

    query
    {
    sellerCreateCreditmemo(orderid:<Int> , invoiceid:<Int>, creditmemo:

    {

    shipping_amount:<Int>

    adjustment_positive:<Int>

    adjustment_negative:<Int>

    do_offline: <Int>

    items: {

    itemid:<Int>

    qty:<Int>

    }})

    }

    This is used to create credit memo for seller order.

    JSON

    9

    query
    {
    sellerCreateCreditmemo(orderid: <Int>, creditmemoid: <Int>)

    }

    This is used to get credit memo details.

    JSON

    10

    query
    {
    sellerMailToAdmin(query:<String>, subject:<string>)

    }

    This is used to ask questions to admin.

    JSON

    11

    query
    {
    sellerMailToSeller(customer_name:<String>, customer_email: <String>, query: <String>, subject: <String>)

    }

    This is used to contact seller.

    JSON

    12

    query
    {
    sellerBecomePartner(shop_url: <String>, is_seller: <Int>)

    }

    This is used to request to become partner.

    JSON

    13

    query
    {
    sellerCreateShipment(

    orderid: <Int>

    tracking_number: <String>

    carrier: <String>)

     

    }

    This is used to request to create shipment.

    JSON

    For more information about Magento Web APIs you can check http://devdocs.magento.com/guides/v2.0/get-started/bk-get-started-api.html

    Admin Management – Access To Admin Level Resources

    Admin has to go to System > Integration > Add New Integration. Here admin can add new integration.

    Here admin has to fill up all the information such as name, email, Callback URL and Identity link URL.

    Then admin has to select the resources which he wants to give access to the new admin member. Admin can select all the resources or can choose some particular resources which the admin wants to give access to the new admin member.

     

    That’s all for Marketplace Web Services API For Magento 2, if you still have any issue feel free to add a ticket and let us know your views to make the module better https://webkul.uvdesk.com/en/

    Current Product Version - 2.1.0

    Supported Framework Version - Magento 2.0.x, 2.1.x, 2.2.x, 2.3.x.

    . . .

    Comments (2)

    Add Your Comment

  • Peter s
    where is seller account registration API
    • Suraj Kumar
      Hi Peter, seller account registration API is not included in this module. Further, we can customize the same. Please email your requirements at support@webkul.com so that we can assist you better. Thanks
  • Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close

    Table of Content

    Hide Index