Comments (10)
Can you give a snippet of your code? It's been a while since I've used the FetchApp api and it looks like they have a single endpoint for all API requests now. Below is the code I used and I'm getting account information.
// replace $key and $token with your own
$key = 'demokey';
$token = 'demotoken';
$fetch_app = new FetchApp( 'https://app.fetchapp.com', $key, $token );
$account = $fetch_app->account();
var_dump($account);
from fetchapp.
Hi,,
thanks for your reply. Here is the code -
include 'Fetchapp.php';
$xml = '<?xml version="1.0" encoding="UTF-8"?>
<order>
<id>1</id>
<vendor_id>1554898798</vendor_id>
<first_name>Bugs</first_name>
<last_name>Bunny</last_name>
<email>[email protected]</email>
<currency>USD</currency>
<custom_1>Optional</custom_1>
<custom_2>Custom</custom_2>
<custom_3>Values</custom_3>
<expiration_date type="datetime">2010-09-07T15:08:02+00:00</expiration_date>
<download_limit type="integer">5</download_limit>
<send_email>true</send_email>
<order_items type="array">
<order_item>
<sku>1</sku>
<downloads_remaining type="integer">4</downloads_remaining>
<price type="float">4.99</price>
</order_item>
</order_items>
</order>';
$fetch_app = new FetchApp( 'https://myname.fetchapp.com', 'myname', 'mytocken' );
$new_order = simplexml_load_string($xml);
$order_create_response = $fetch_app->orders('create', $new_order);
But this code not creating any order. However I tried your account inforamtion code which is working fine.
from fetchapp.
Have you tried to var_dump your $order_create_response? When I use your code there is an error response from Fetch.
object(SimpleXMLElement)#3 (1) {
[0]=>
string(51) "Order does not contain FetchApp SKUs and is ignored"
}
from fetchapp.
You can see in my above pasted code that I have set sku of product in xml. then why this error is coming.?
from fetchapp.
Can you var_dump your response?
var_dump($order_create_response);
from fetchapp.
yes, I did that and got same error-
object(SimpleXMLElement)#3 (1) { [0]=> string(51) "Order does not contain FetchApp SKUs and is ignored" }
and if I var_dump() my xml variable i.e. $new_order, I got this-
object(SimpleXMLElement)#2 (13) { ["id"]=> string(1) "1" ["vendor_id"]=> string(10) "1554898798" ["first_name"]=> string(4) "Bugs" ["last_name"]=> string(5) "Bunny" ["email"]=> string(14) "[email protected]" ["currency"]=> string(3) "USD" ["custom_1"]=> string(8) "Optional" ["custom_2"]=> string(6) "Custom" ["custom_3"]=> string(6) "Values" ["expiration_date"]=> string(25) "2010-09-07T15:08:02+00:00" ["download_limit"]=> string(1) "5" ["send_email"]=> string(4) "true" ["order_items"]=> object(SimpleXMLElement)#4 (2) { ["@attributes"]=> array(1) { ["type"]=> string(5) "array" } ["order_item"]=> object(SimpleXMLElement)#5 (3) { ["skus"]=> string(1) "1" ["downloads_remaining"]=> string(1) "4" ["price"]=> string(4) "4.99" } } }
I have set sku of product in xml. then why this error is coming.?
from fetchapp.
Hello Json,
Have you understood my problem or have you any solution for my problem.?
Please let me know soon.
Thanks
from fetchapp.
The SKU id you have in your XML is 1. Do you have a product with that SKU number?
SKU numbers must match one of the products in your account in order to create a valid order with it.
from fetchapp.
I have only one product already created with sku 43324.
I am creating new product not updating the existing one, then why should my sku number should match with one of the product in my account.?
Although I changed sku in xml to 43324 and and then checked but still same problem there,
from fetchapp.
According to your code, you are trying to create a new order. A new order requires a valid product SKU. If you want to create a product, you have to change the endpoint and the XML to follow the specs at http://www.fetchapp.com/pages/help-api2
from fetchapp.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fetchapp.