There are in toal of 5 API endpoints included in the FeedAPI, please find below the recommended flowfrom Miravia to call our Feed API:
Batch Validation Endpoint : For PRODUCT_LISTING , It is strongly recommended that use this endpoint to verify your listing request before creating a Feed task. This endpoint will return all errors regarding your request.
Initiate a task to create documents which can be accessd by Miravia, specifying the content type for the feed that you are submitting. returns a feedDocumentId value and a URL for uploading the feed contents. We only support "application/json" at the moment.
{ "content_type":"application/json" }
{ "feed_result":{ "result":{ "feed_document_id":"e702ddea-e703-43e2-b30a-5f9c5944c044.4000002768003", "url":"https://airse-open-feed.oss-eu-central-1.aliyuncs.com/e702ddea-e703-43e2-b30a-5f9c5944c044.4000002768003.json?Expires=1658472289&OSSAccessKeyId=LTAI5tPS8gpPYr9xZ5WcvRLU&Signature=G10tIi2NDqh%2BIIkcBkEYJCHvwgo%3D" }, "success":true }, "code":"0", "request_id":"21038f5516584686892251082" }
Upload your feed document (which must be in JSON format) using the URL of the CreateFeedDocument API response.
Request Method: PUT
<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>${your version}</version> </dependency>
HttpPut httpPut = new HttpPut("/feed/createFeedDocument api response url"); BasicHttpEntity httpEntity = new BasicHttpEntity(); httpEntity.setContent("your file InputStream"); httpEntity.setContentLength("your file size"); httpEntity.setContentType("/feed/createFeedDocument api input parameter content_type"); httpPut.setEntity(httpEntity); CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(httpPut, HttpClientContext.create());
Call the CreateFeed operation to specify the feed document identifier, the feed type.
{ "feed_type":"PRODUCT_LISTING", "feed_document_id":"9d350a9a-7861-46b5-b404-2e05f22765c2.1001" }
{ "feed_result":{ "result":52, "success":true }, "code":"0", "request_id":"21038f5516584687399921083" }
After you call the createFeed operation, Miravia receives the request and begins to process the feed. You must confirm that processing has completed before you continue.
{ "feed_id":"52" }
{ "feed_result":{ "result":{ "processing_end_time":"2022-07-22 13:46:03", "created_time":"2022-07-22 07:45:40", "processing_status":"DONE", "result_feed_document_id":"ddead6cc-fb4b-487c-9ddb-e97557e847bc.4000002768003", "feed_type":"PRODUCT_LISTING", "processing_start_time":"2022-07-22 13:46:02", "feed_id":52 }, "success":true }, "code":"0", "request_id":"21038f5516584771545771123" }
{ "feed_result":{ "result":{ "created_time":"2022-07-22 07:19:26", "processing_status":"IN_PROGRESS", "feed_type":"PRODUCT_LISTING", "processing_start_time":"2022-07-22 13:20:02", "feed_id":51 }, "success":true }, "code":"0", "request_id":"21038f5516584771752521124" }
The following processingStatus values confirm that processing is complete:
Request Method: GET
Content-Type: application/json
{ "Product":{ "feedId":54, "gmtCreate":1658456282000, "gmtModified":1658456282000, "id":25, "index":"Product", "status":"SUCCESS" } }
{ "Product":{ "detail":"{\"traceId\":\"210380cf16584781216872846dac87\",\"message\":\"{\\\"errorCode\\\":\\\"500\\\",\\\"errorDetail\\\":[{\\\"code\\\":\\\"THD_IC_ERR_F_IC_INFRA_PRODUCT_036\\\",\\\"seller_sku\\\":\\\"\\\",\\\"field\\\":\\\"Product\\\",\\\"message\\\":\\\"THD_IC_ERR_F_IC_INFRA_PRODUCT_036:Insert sku outer id relation failed, outerId already exists, sell ID:4,000,002,768,003,sku ID:2,068,481,467,064,734,outer ID:test-product-creatation-for-api-chasetest11123,serverIP:33.27.90.239\\\"}],\\\"errorMsg\\\":\\\"E500: Create product failed\\\",\\\"errors\\\":[{\\\"code\\\":\\\"THD_IC_ERR_F_IC_INFRA_PRODUCT_036\\\",\\\"field\\\":\\\"Product\\\",\\\"sellerSku\\\":\\\"\\\",\\\"message\\\":\\\"THD_IC_ERR_F_IC_INFRA_PRODUCT_036:Insert sku outer id relation failed, outerId already exists, sell ID:4,000,002,768,003,sku ID:2,068,481,467,064,734,outer ID:test-product-creatation-for-api-chasetest11123,serverIP:33.27.90.239\\\"}],\\\"success\\\":false}\"}", "feedId":55, "gmtCreate":1658456522000, "gmtModified":1658456522000, "id":26, "index":"Product", "status":"FAIL" } }
Optional attributes can be added or removed, the rules are the same as the createproduct api
{ "Product":{ "PrimaryCategory":62198631, "Images":{ "Image":[ "https://fb-es.mrvcdn.com/kf/Ed72d9145a56c45668e374567eb5e283df.jpg" ] }, "Attributes":{ "name":"test product creatation", "short_description":"test product highlights", "description":"test product description", "brand":"No Brand", "model":"test model", "type_tools":"Electronic", "warranty_type":"Local Supplier Warranty", "warranty":"12 Years", "Hazmat":"Battery,Flammable" }, "Skus":{ "Sku":[ { "quantity":"1", "SellerSku":"test-product-creatation-for-api-chasetest11123", "color_family":"Black", "ean_code":"123", "special_price":"11", "price":"23", "package_length":"1", "package_weight":"1", "package_content":"test what's in the box", "package_width":"1", "package_height":"1", "Images":{ "Image":[ "https://fb-es.mrvcdn.com/kf/Ed72d9145a56c45668e374567eb5e283df1.jpg" ] } } ] } }, "Product2":{ }, "Product3":{ } }
{ "updateTask1":{ "Sku":{ "ItemId":"1355777715065245", "SkuId":"2068481483383197", "SellerSku":"test-product-creatation-for-api-chasetest11123", "Price":"1000", "SalePrice":"995", "Quantity":"1000" } }, "updateTask2":{ } }