jlevers / selling-partner-api

A PHP client library for Amazon's Selling Partner API
BSD 3-Clause "New" or "Revised" License
398 stars 185 forks source link

Request for full working feed upload example #50

Closed lancelim8122 closed 3 years ago

lancelim8122 commented 3 years ago

Hi Author, Please share working example for uploading a feed document. I have download your example but I cannot upload feed document.

jlevers commented 3 years ago

Sorry my example isn't working for you! I tried to do some testing in order to figure out what's wrong with the example, but right now Amazon is giving me a 400 InvalidInput error anytime I try to call createFeed. I'm getting the error even when I use code from a project that doesn't depend on this library at all, and which was certainly working a month or so ago.

I've mentioned this in a couple issues in the main SP API repository (https://github.com/amzn/selling-partner-api-models/issues/1559, https://github.com/amzn/selling-partner-api-models/issues/1463), and hopefully I'll get a response soon. When I'm able to upload feeds again, I'll circle back to this issue.

jlevers commented 3 years ago

@lancelim8122 -- I've updated the document upload example in the README. Please give it a try and let me know if it works for you.

lancelim8122 commented 3 years ago

Hi, May I know how to use your SDK to download back the feed document (decrypted) content? Your example is to download report document but I need to download feed document.

Actually I have tried your SDK, but how can I supply the Role ARN in order to connecting to Amazon Selling Partner API?

Do you mind providing your whatsapp? So we can easily communicate.

On Wed, Jul 7, 2021 at 1:27 PM Jesse Evers @.***> wrote:

@lancelim8122 https://github.com/lancelim8122 -- I've updated the document upload example in the README https://github.com/jlevers/selling-partner-api/blob/main/README.md#uploading-a-feed-document. Please give it a try and let me know if it works for you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jlevers/selling-partner-api/issues/50#issuecomment-875293329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUXL37NUV63JAWFUCNNRO7LTWPQUTANCNFSM472ELVJQ .

JosueExsim commented 3 years ago

By consuming the createFeedDocument method I am getting the response id for the POST_PRODUCT_DATA type. But I can't make functions for the createFeed () method I want to create a new product, do you have an example of how to do this please?

Thanks.

lancelim8122 commented 3 years ago

I do send a feed to amazon but it's POST_ORDER_FULFILLMENT_DATA. Below is my example:

<?php require_once './vendor/autoload.php'; $options = [ 'refresh_token' => 'Atzr|IwEBxxxx....', // Aztr|... 'client_id' => 'amzn1.application-oa2-client.e7a3966600104f54987f3b3e62dd292f', // App ID from Seller Central, amzn1.sellerapps.app.cfbfac4a-...... 'client_secret' => 'xxxxxx...', // The corresponding Client Secret 'region' => \ClouSale\AmazonSellingPartnerAPI\SellingPartnerRegion::$FAR_EAST, // or NORTH_AMERICA / FAR_EAST 'access_key' => 'AKIAXXXX...', // Access Key of AWS IAM User, for example AKIAABCDJKEHFJDS 'secret_key' => 'xxxx...', // Secret Key of AWS IAM User 'endpoint' => \ClouSale\AmazonSellingPartnerAPI\SellingPartnerEndpoint::$FAR_EAST, // or NORTH_AMERICA / FAR_EAST 'role_arn' => 'arn:aws:iam::410631840271:role/SellingPartnerAPI_Role', // AWS IAM Role ARN for example: arn:aws:iam::123456789:role/Your-Role-Name ]; $accessToken = \ClouSale\AmazonSellingPartnerAPI\SellingPartnerOAuth::getAccessTokenFromRefreshToken( $options['refresh_token'], $options['client_id'], $options['client_secret'] ); $assumedRole = \ClouSale\AmazonSellingPartnerAPI\AssumeRole::assume( $options['region'], $options['access_key'], $options['secret_key'], $options['role_arn'] ); $config = \ClouSale\AmazonSellingPartnerAPI\Configuration::getDefaultConfiguration(); $config->setHost($options['endpoint']); $config->setAccessToken($accessToken); $config->setAccessKey($assumedRole->getAccessKeyId()); $config->setSecretKey($assumedRole->getSecretAccessKey()); $config->setRegion($options['region']); $config->setSecurityToken($assumedRole->getSessionToken()); //print $options['region'];die; $note = '<?xml version="1.0"?> <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">

1.01 gjhhjh
OrderFulfillment 1 asd12 asddd122 asfjkgnds ggg hh '; $xml = new SimpleXMLElement($note); $feedApi = new \ClouSale\AmazonSellingPartnerAPI\Api\FeedsApi($config); $contentType = 'text/xml; charset=UTF-8'; // please pay attention here, the content_type will be used many time $feedDocument = $feedApi->createFeedDocument(new \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification([ 'content_type' => $contentType, ])); $feedDocumentId = $feedDocument->getPayload()->getFeedDocumentId(); $url = $feedDocument->getPayload()->getUrl(); $key = $feedDocument->getPayload()->getEncryptionDetails()->getKey(); $key = base64_decode($key, true); $initializationVector = base64_decode($feedDocument->getPayload()->getEncryptionDetails()->getInitializationVector(), true); $encryptedFeedData = openssl_encrypt(utf8_encode(array2xml([// array2xml is my private function, you can write your own function 'data' => 'test', ], $xml)), 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $initializationVector); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 90, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $encryptedFeedData, CURLOPT_HTTPHEADER => [ 'Accept: application/xml', 'Content-Type: ' . $contentType, ], )); $response = curl_exec($curl); $error = curl_error($curl); $httpcode = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($httpcode >= 200 && $httpcode <= 299) { // success // success $createFeedParams = [ "feedType" => "POST_ORDER_FULFILLMENT_DATA", "marketplaceIds" => ["A19VAU5U5O7RUS"], "inputFeedDocumentId" => $feedDocumentId, "feedOptions" => [ "AmazonOrderID" => '250-0074400-0209446', "FulfillmentDate" => '2021-07-07T09:47:06.000Z', "FulfillmentData" => [ 'CarrierName' => 'FedEx', 'ShippingMethod' => 'FedEx First Class', 'ShipperTrackingNumber' => '781113347XXX', ], 'Item' => [ 'AmazonOrderItemCode' => '07065034910334', 'Quantity' => '1', ], ] ]; $r = $feedApi->createFeed(json_encode($createFeedParams)); $apiInstance = new \ClouSale\AmazonSellingPartnerAPI\Api\FeedsApi($config); try { print "
";
$feed_id = $r->getPayload()->getFeedId();
print "feed document";
print_r($feedDocument->getPayload());
print_r($r->getPayload());
print_r($createFeedParams);
$result = $apiInstance->getFeed($feed_id);
print_r($result);
print "
"; } catch (Exception $e) { echo 'Exception when calling FeedsApi->getFeeds: ', $e->getMessage(), PHP_EOL; } } else { // error } function array2xml(array $data, SimpleXMLElement $xml) { foreach ($data as $k => $v) { is_array($v) ? array2xml($v, $xml->addChild($k)) : $xml->addChild($k, $v); } return $xml; }

On Thu, Jul 8, 2021 at 1:54 AM JosueExsim @.***> wrote:

By consuming the createFeedDocument method I am getting the response id for the POST_PRODUCT_DATA type. But I can't make functions for the createFeed () method I want to create a new product, do you have an example of how to do this please?

Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jlevers/selling-partner-api/issues/50#issuecomment-875808499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUXL37IFBMEK47NR7N4WSN3TWSIF7ANCNFSM472ELVJQ .

lancelim8122 commented 3 years ago

I'm using the ClouSale php SDK. But I getting below error:

SignatureDoesNotMatch The request signature we calculated does not match the signature you provided. Check your key and signing method. AKIAXXXXX.... AWS4-HMAC-SHA256 20210708T100621Z 20210708/us-west-2/s3/aws4_request 966480ca3fc93a4782aae7c05580441217450e548954cc5e0c0f9bfc4765cc81 14002d21844667d75cd9bfb40ae0c6a0d40a144a8a928df4bd78586bc40c2ca9 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 32 31 30 37 30 38 54 31 30 30 36 32 31 5a 0a 32 30 32 31 30 37 30 38 2f 75 73 2d 77 65 73 74 2d 32 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 39 36 36 34 38 30 63 61 33 66 63 39 33 61 34 37 38 32 61 61 65 37 63 30 35 35 38 30 34 34 31 32 31 37 34 35 30 65 35 34 38 39 35 34 63 63 35 65 30 63 30 66 39 62 66 63 34 37 36 35 63 63 38 31 GET //NinetyDays/amzn1.tortuga.3.cc4b2cb5-5604-457f-aed3-1919142fccd0.T3RX9DBE1UX0IF X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAXXXX....%2F20210708%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20210708T100621Z&X-Amz-Expires=300&X-Amz-SignedHeaders=content-type%3Bhost content-type: host:tortuga-prod-fe.s3-us-west-2.amazonaws.com content-type;host UNSIGNED-PAYLOAD 47 45 54 0a 2f 2f 4e 69 6e 65 74 79 44 61 79 73 2f 61 6d 7a 6e 31 2e 74 6f 72 74 75 67 61 2e 33 2e 63 63 34 62 32 63 62 35 2d 35 36 30 34 2d 34 35 37 66 2d 61 65 64 33 2d 31 39 31 39 31 34 32 66 63 63 64 30 2e 54 33 52 58 39 44 42 45 31 55 58 30 49 46 0a 58 2d 41 6d 7a 2d 41 6c 67 6f 72 69 74 68 6d 3d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 26 58 2d 41 6d 7a 2d 43 72 65 64 65 6e 74 69 61 6c 3d 41 4b 49 41 58 33 52 36 32 4c 56 42 4c 49 4b 52 48 45 4c 58 25 32 46 32 30 32 31 30 37 30 38 25 32 46 75 73 2d 77 65 73 74 2d 32 25 32 46 73 33 25 32 46 61 77 73 34 5f 72 65 71 75 65 73 74 26 58 2d 41 6d 7a 2d 44 61 74 65 3d 32 30 32 31 30 37 30 38 54 31 30 30 36 32 31 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 33 30 30 26 58 2d 41 6d 7a 2d 53 69 67 6e 65 64 48 65 61 64 65 72 73 3d 63 6f 6e 74 65 6e 74 2d 74 79 70 65 25 33 42 68 6f 73 74 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 0a 68 6f 73 74 3a 74 6f 72 74 75 67 61 2d 70 72 6f 64 2d 66 65 2e 73 33 2d 75 73 2d 77 65 73 74 2d 32 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3b 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44 SDN6VXHR0ZYSTHM9 0EYX6v2+uKhLJQnUZc7a5OcO69c9005vFph4j8Re5qHI54HEORdk75FQPzHG6K3UDJrkFWcjE/I=

On Thu, Jul 8, 2021 at 9:40 PM Lim Zhen Yuan @.***> wrote:

I do send a feed to amazon but it's POST_ORDER_FULFILLMENT_DATA. Below is my example:

<?php require_once './vendor/autoload.php'; $options = [ 'refresh_token' => 'Atzr|IwEBxxxx', // Aztr|... 'client_id' => 'amzn1.application-oa2-client.e7a3966600104f54987f3b3e62dd292f', // App ID from Seller Central, amzn1.sellerapps.app.cfbfac4a-...... 'client_secret' => 'xxxx....', // The corresponding Client Secret 'region' => \ClouSale\AmazonSellingPartnerAPI\SellingPartnerRegion::$FAR_EAST, // or NORTH_AMERICA / FAR_EAST 'access_key' => 'AKIA....', // Access Key of AWS IAM User, for example AKIAABCDJKEHFJDS 'secret_key' => 'xxxx....', // Secret Key of AWS IAM User 'endpoint' => \ClouSale\AmazonSellingPartnerAPI\SellingPartnerEndpoint::$FAR_EAST, // or NORTH_AMERICA / FAR_EAST 'role_arn' => 'arn:aws:iam::xxxxxxxxxxxxxx:role/SellingPartnerAPI_Role', // AWS IAM Role ARN for example: arn:aws:iam::123456789:role/Your-Role-Name ]; $accessToken = \ClouSale\AmazonSellingPartnerAPI\SellingPartnerOAuth::getAccessTokenFromRefreshToken( $options['refresh_token'], $options['client_id'], $options['client_secret'] ); $assumedRole = \ClouSale\AmazonSellingPartnerAPI\AssumeRole::assume( $options['region'], $options['access_key'], $options['secret_key'], $options['role_arn'] ); $config = \ClouSale\AmazonSellingPartnerAPI\Configuration::getDefaultConfiguration(); $config->setHost($options['endpoint']); $config->setAccessToken($accessToken); $config->setAccessKey($assumedRole->getAccessKeyId()); $config->setSecretKey($assumedRole->getSecretAccessKey()); $config->setRegion($options['region']); $config->setSecurityToken($assumedRole->getSessionToken()); //print $options['region'];die; $note = '<?xml version="1.0"?> <AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">

1.01 gjhhjh
OrderFulfillment 1 asd12 asddd122 asfjkgnds ggg hh '; $xml = new SimpleXMLElement($note); $feedApi = new \ClouSale\AmazonSellingPartnerAPI\Api\FeedsApi($config); $contentType = 'text/xml; charset=UTF-8'; // please pay attention here, the content_type will be used many time $feedDocument = $feedApi->createFeedDocument(new \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification([ 'content_type' => $contentType, ])); $feedDocumentId = $feedDocument->getPayload()->getFeedDocumentId(); $url = $feedDocument->getPayload()->getUrl(); $key = $feedDocument->getPayload()->getEncryptionDetails()->getKey(); $key = base64_decode($key, true); $initializationVector = base64_decode($feedDocument->getPayload()->getEncryptionDetails()->getInitializationVector(), true); $encryptedFeedData = openssl_encrypt(utf8_encode(array2xml([// array2xml is my private function, you can write your own function 'data' => 'test', ], $xml)), 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $initializationVector); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 90, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $encryptedFeedData, CURLOPT_HTTPHEADER => [ 'Accept: application/xml', 'Content-Type: ' . $contentType, ], )); $response = curl_exec($curl); $error = curl_error($curl); $httpcode = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($httpcode >= 200 && $httpcode <= 299) { // success // success $createFeedParams = [ "feedType" => "POST_ORDER_FULFILLMENT_DATA", "marketplaceIds" => ["A19VAU5U5O7RUS"], "inputFeedDocumentId" => $feedDocumentId, "feedOptions" => [ "AmazonOrderID" => '250-0074400-0209446', "FulfillmentDate" => '2021-07-07T09:47:06.000Z', "FulfillmentData" => [ 'CarrierName' => 'FedEx', 'ShippingMethod' => 'FedEx First Class', 'ShipperTrackingNumber' => '781113347XXX', ], 'Item' => [ 'AmazonOrderItemCode' => '07065034910334', 'Quantity' => '1', ], ] ]; $r = $feedApi->createFeed(json_encode($createFeedParams)); $apiInstance = new \ClouSale\AmazonSellingPartnerAPI\Api\FeedsApi($config); try { print "
";
$feed_id = $r->getPayload()->getFeedId();
print "feed document";
print_r($feedDocument->getPayload());
print_r($r->getPayload());
print_r($createFeedParams);
$result = $apiInstance->getFeed($feed_id);
print_r($result);
print "
"; } catch (Exception $e) { echo 'Exception when calling FeedsApi->getFeeds: ', $e->getMessage(), PHP_EOL; } } else { // error } function array2xml(array $data, SimpleXMLElement $xml) { foreach ($data as $k => $v) { is_array($v) ? array2xml($v, $xml->addChild($k)) : $xml->addChild($k, $v); } return $xml; }

On Thu, Jul 8, 2021 at 1:54 AM JosueExsim @.***> wrote:

By consuming the createFeedDocument method I am getting the response id for the POST_PRODUCT_DATA type. But I can't make functions for the createFeed () method I want to create a new product, do you have an example of how to do this please?

Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jlevers/selling-partner-api/issues/50#issuecomment-875808499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUXL37IFBMEK47NR7N4WSN3TWSIF7ANCNFSM472ELVJQ .

JosueExsim commented 3 years ago

I do send a feed to amazon but it's POST_ORDER_FULFILLMENT_DATA. Below is my example: <?php require_once './vendor/autoload.php'; $options = [ 'refresh_token' => 'Atzr|IwEBIKe96x5EL71kCjCA0XC3z7lGEfwxzGpUQ3G0rB2AFhDsMj5m9cSEd0U8s4NmQ7lswOvqnf-4LQup_4hSn3WWxV-Kx8_JoOBQIewpxdhtF1hlu1DsyGrCBTJwQcUIP7-Zvbfs7cjwPt5w1ySuNxJQFca14-TjZdowjKK9hljll1znxMSGCG1gnd7Rty4_A3Wks-ixSbcStFkLWXMDHcaETF3mf2xzum1rslng1CmnFdRxUpBJ6_HFVpH-GN-0a7kTW3ibB8mm35Vf6MivCMQgO2BxkXs8xOcovMgtkGSLKGWdoVHmdnoolKmw7kv6u69ppcg', // Aztr|... 'client_id' => 'amzn1.application-oa2-client.e7a3966600104f54987f3b3e62dd292f', // App ID from Seller Central, amzn1.sellerapps.app.cfbfac4a-...... 'client_secret' => '4f0cebe97bae21e68b2de69a0ed30fca83a691f157e27734c1a1353b83128616', // The corresponding Client Secret 'region' => \ClouSale\AmazonSellingPartnerAPI\SellingPartnerRegion::$FAR_EAST, // or NORTH_AMERICA / FAR_EAST 'access_key' => 'AKIAV7G4QUIH6YAQSBAC', // Access Key of AWS IAM User, for example AKIAABCDJKEHFJDS 'secret_key' => 'w4KM9j3Q0VAuUcZBp1BHbfaH6oLfD2q255Yw0TeC', // Secret Key of AWS IAM User 'endpoint' => \ClouSale\AmazonSellingPartnerAPI\SellingPartnerEndpoint::$FAR_EAST, // or NORTH_AMERICA / FAR_EAST 'role_arn' => 'arn:aws:iam::410631840271:role/SellingPartnerAPI_Role', // AWS IAM Role ARN for example: arn:aws:iam::123456789:role/Your-Role-Name ]; $accessToken = \ClouSale\AmazonSellingPartnerAPI\SellingPartnerOAuth::getAccessTokenFromRefreshToken( $options['refresh_token'], $options['client_id'], $options['client_secret'] ); $assumedRole = \ClouSale\AmazonSellingPartnerAPI\AssumeRole::assume( $options['region'], $options['access_key'], $options['secret_key'], $options['role_arn'] ); $config = \ClouSale\AmazonSellingPartnerAPI\Configuration::getDefaultConfiguration(); $config->setHost($options['endpoint']); $config->setAccessToken($accessToken); $config->setAccessKey($assumedRole->getAccessKeyId()); $config->setSecretKey($assumedRole->getSecretAccessKey()); $config->setRegion($options['region']); $config->setSecurityToken($assumedRole->getSessionToken()); //print $options['region'];die; $note = '<?xml version="1.0"?>

1.01 gjhhjh
OrderFulfillment 1 asd12 asddd122 asfjkgnds ggg hh '; $xml = new SimpleXMLElement($note); $feedApi = new \ClouSale\AmazonSellingPartnerAPI\Api\FeedsApi($config); $contentType = 'text/xml; charset=UTF-8'; // please pay attention here, the content_type will be used many time $feedDocument = $feedApi->createFeedDocument(new \ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentSpecification([ 'content_type' => $contentType, ])); $feedDocumentId = $feedDocument->getPayload()->getFeedDocumentId(); $url = $feedDocument->getPayload()->getUrl(); $key = $feedDocument->getPayload()->getEncryptionDetails()->getKey(); $key = base64_decode($key, true); $initializationVector = base64_decode($feedDocument->getPayload()->getEncryptionDetails()->getInitializationVector(), true); $encryptedFeedData = openssl_encrypt(utf8_encode(array2xml([// array2xml is my private function, you can write your own function 'data' => 'test', ], $xml)), 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $initializationVector); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $url, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 90, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $encryptedFeedData, CURLOPT_HTTPHEADER => [ 'Accept: application/xml', 'Content-Type: ' . $contentType, ], )); $response = curl_exec($curl); $error = curl_error($curl); $httpcode = (int) curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($httpcode >= 200 && $httpcode <= 299) { // success // success $createFeedParams = [ "feedType" => "POST_ORDER_FULFILLMENT_DATA", "marketplaceIds" => ["A19VAU5U5O7RUS"], "inputFeedDocumentId" => $feedDocumentId, "feedOptions" => [ "AmazonOrderID" => '250-0074400-0209446', "FulfillmentDate" => '2021-07-07T09:47:06.000Z', "FulfillmentData" => [ 'CarrierName' => 'FedEx', 'ShippingMethod' => 'FedEx First Class', 'ShipperTrackingNumber' => '781113347XXX', ], 'Item' => [ 'AmazonOrderItemCode' => '07065034910334', 'Quantity' => '1', ], ] ]; $r = $feedApi->createFeed(json_encode($createFeedParams)); $apiInstance = new \ClouSale\AmazonSellingPartnerAPI\Api\FeedsApi($config); try { print "
"; $feed_id = $r->getPayload()->getFeedId(); print "feed document"; print_r($feedDocument->getPayload()); print_r($r->getPayload()); print_r($createFeedParams); $result = $apiInstance->getFeed($feed_id); print_r($result); print "
"; } catch (Exception $e) { echo 'Exception when calling FeedsApi->getFeeds: ', $e->getMessage(), PHP_EOL; } } else { // error } function array2xml(array $data, SimpleXMLElement $xml) { foreach ($data as $k => $v) { is_array($v) ? array2xml($v, $xml->addChild($k)) : $xml->addChild($k, $v); } return $xml; } On Thu, Jul 8, 2021 at 1:54 AM JosueExsim @.***> wrote: By consuming the createFeedDocument method I am getting the response id for the POST_PRODUCT_DATA type. But I can't make functions for the createFeed () method I want to create a new product, do you have an example of how to do this please? Thanks. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#50 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUXL37IFBMEK47NR7N4WSN3TWSIF7ANCNFSM472ELVJQ .

I appreciate your response. I did it with IAM user and I get the following result. If my API is still in draft but I'm using the production endpoint, should I see my new product in the seller's store?

feed documentClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedDocumentResult Object ( [container:protected] => Array ( [feed_document_id] => amzn1.tortuga.3.e028fd85-807b-4631-b2a8-f2913b7c9ac5.T1H9NEZF93HCLB [url] => https://tortuga-prod-na.s3-external-1.amazonaws.com/%2FNinetyDays/amzn1.tortuga.3.e028fd85-807b-4631-b2a8-f2913b7c9ac5.T1H9NEZF93HCLB?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20210708T160940Z&X-Amz-SignedHeaders=content-type%3Bhost&X-Amz-Expires=300&X-Amz-Credential=AKIA5U6MO6RAITE6VEGB%2F20210708%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=24c2b6c7e4628fb13fdcde442f0c58b7cafb40a8f23eb438c54c26f2778a7cf7 [encryption_details] => ClouSale\AmazonSellingPartnerAPI\Models\Feeds\FeedDocumentEncryptionDetails Object ( [container:protected] => Array ( [standard] => AES [initialization_vector] => KUQm8S7Fri1+egOQaFqPHQ== [key] => jv0+fW5Cwnv8Eb/Y96cXxzg6YQ1A6k4rs5hN3vZC4s0= )

            )

    )

) ClouSale\AmazonSellingPartnerAPI\Models\Feeds\CreateFeedResult Object ( [container:protected] => Array ( [feed_id] => 50004018816 )

) Array ( [feedType] => POST_ORDER_FULFILLMENT_DATA [marketplaceIds] => Array ( [0] => A1AM78C64UM0Y8 )

[inputFeedDocumentId] => amzn1.tortuga.3.e028fd85-807b-4631-b2a8-f2913b7c9ac5.T1H9NEZF93HCLB
[feedOptions] => Array
    (
        [AmazonOrderID] => 250-0074400-0209446
        [FulfillmentDate] => 2021-07-07T09:47:06.000Z
        [FulfillmentData] => Array
            (
                [CarrierName] => FedEx
                [ShippingMethod] => FedEx First Class
                [ShipperTrackingNumber] => 781113347XXX
            )

        [Item] => Array
            (
                [AmazonOrderItemCode] => 07065034910334
                [Quantity] => 1
            )

    )

) ClouSale\AmazonSellingPartnerAPI\Models\Feeds\GetFeedResponse Object ( [container:protected] => Array ( [payload] => ClouSale\AmazonSellingPartnerAPI\Models\Feeds\Feed Object ( [container:protected] => Array ( [feed_id] => 50004018816 [feed_type] => POST_ORDER_FULFILLMENT_DATA [marketplace_ids] => Array ( [0] => A1AM78C64UM0Y8 )

                        [created_time] => DateTime Object
                            (
                                [date] => 2021-07-08 16:09:41.000000
                                [timezone_type] => 1
                                [timezone] => +00:00
                            )

                        [processing_status] => IN_QUEUE
                        [processing_start_time] => 
                        [processing_end_time] => 
                        [result_feed_document_id] => 
                    )

            )

        [errors] => 
    )

)

jlevers commented 3 years ago

@lancelim8122 @JosueExsim if you're using the ClouSale library, please ask for support there.