Urgent: FrappeCloud Web Service API help needed

87 views
Skip to first unread message

Ankit

unread,
Jun 24, 2014, 8:26:55 AM6/24/14
to erpnext-dev...@googlegroups.com
Hello,

Since the upgrade to frappe cloud, the webservice api we were using has changed and our business is suffering.
Support hasn't helped and suggested to use the forums, so I hope someone can help. Everyday we delay this the work piles up as the automation of creating customers and invoices is absolutely essential to our business.

I just need an example of using the webservice to insert a customer. Even a url would do. Its better than the time I have wasted doing the trial and error.

Note: Login api works and I get check whether a customer exists.

i have tried so the following urls:
1.https://company.frappecloud.com/server.py?cmd=frappe.client.insert&doclist=%5B%7B%22doctype%22%3A%22Customer%22%2C%22customer_name%22%3A%22Ajay%20Devgan%22%2C%22customer_type%22%3A%22Individual%22%2C%22customer_group%22%3A%22Default%20Customer%20Group%22%2C%22territory%22%3A%22Default%22%2C%22company%22%3A%22COMPANY%22%7D%5D

2.https://company.frappecloud.com/api/resource/Customer?data=%5B%7B%22doctype%22%3A%22Customer%22%2C%22customer_name%22%3A%22Ajay%20Devgan%22%2C%22customer_type%22%3A%22Individual%22%2C%22customer_group%22%3A%22Default%20Customer%20Group%22%2C%22territory%22%3A%22Default%22%2C%22company%22%3A%22COMPANY%22%7D%5D

I seriously hope you value your customers and respond. This is the response from your support email, so dont ask me to contact them again,
"

Version 4 has new API. I am afraid, you will need to redo the web service integration to make it work again. 

 

Please check with our developers directly on forum or IRC chat for discussing  this issue.

-- 
Thanks and Regards,

Uxxxxx Xxxxxx
www.erpnext.com"


We are paying customers of your product and have been for last 3 years. I integrated the web service api into a third party product using the help from support but seems like they are too busy to respond with an example.


regards

Ankit

Rushabh Mehta

unread,
Jun 24, 2014, 8:37:07 AM6/24/14
to erpnext-dev...@googlegroups.com
Use the new API lib - its quite similar to the old one

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/82a581a0-0ad8-492d-aa0a-4be4110b4eaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rushabh Mehta

unread,
Jun 24, 2014, 8:52:48 AM6/24/14
to erpnext-dev...@googlegroups.com
@Ankit - the JSON structure for the data is also different. The child docs are properties in the main doc.

Do a GET on a Sales Order to see the structure.

Ankit

unread,
Jun 24, 2014, 8:54:06 AM6/24/14
to erpnext-dev...@googlegroups.com
Hi Rushabh,

I refered to that example when I started making the changes. Its not working for us.

This is the url that gets generated from JSON. Please spot what is wrong and why it returns the list of customers rather than performing an insert. I am using http post.

https://company.frappecloud.com/api/resource/Customer?data=%5B%7B%22doctype%22%3A%22Customer%22%2C%22customer_name%22%3A%22Ajay%20Devgan%22%2C%22customer_type%22%3A%22Individual%22%2C%22customer_group%22%3A%22Default%20Customer%20Group%22%2C%22territory%22%3A%22Default%22%2C%22company%22%3A%22Comapny%22%7D%5D

regards
Ankit

Rushabh Mehta

unread,
Jun 24, 2014, 8:58:01 AM6/24/14
to erpnext-dev...@googlegroups.com
Insert must be a POST request - are you doing a GET ? and update must be a PUT

The script should work. I just built and used it script for a wiring in Job Applications via Google Forms into our ERP (which is a vanilla application on frappecloud.com)


--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.

Ankit

unread,
Jun 24, 2014, 9:17:31 AM6/24/14
to erpnext-dev...@googlegroups.com
I am doing a POST via the curl library in php. This worked before for insert. So that hasn't changed.
The error i suggests that it is interpreting that as something else

Traceback (innermost last):
  File "/home/frappe/press/benches/2406141220/env/lib/python2.7/site-packages/frappe/app.py", line 49, in application
    response = frappe.api.handle()
  File "/home/frappe/press/benches/2406141220/env/lib/python2.7/site-packages/frappe/api.py", line 97, in handle
    data.update({
 AttributeError: 'list' object has no attribute 'update'

the request options look like this
$options = array(
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => TRUE,
    CURLOPT_HEADER => true,
    CURLOPT_SSL_VERIFYPEER => true,
    CURLOPT_CAINFO => "cacert.crt",
    CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_COOKIE => 'sid='.$sid,
    CURLOPT_POSTFIELDS => $json_string,
    );

regards
Ankit



On Wednesday, June 25, 2014 12:58:01 AM UTC+12, rushabh wrote:
Insert must be a POST request - are you doing a GET ? and update must be a PUT

The script should work. I just built and used it script for a wiring in Job Applications via Google Forms into our ERP (which is a vanilla application on frappecloud.com)
On 24-Jun-2014, at 6:24 pm, Ankit <aps...@gmail.com> wrote:

Hi Rushabh,

I refered to that example when I started making the changes. Its not working for us.

This is the url that gets generated from JSON. Please spot what is wrong and why it returns the list of customers rather than performing an insert. I am using http post.

https://company.frappecloud.com/api/resource/Customer?data=%5B%7B%22doctype%22%3A%22Customer%22%2C%22customer_name%22%3A%22Ajay%20Devgan%22%2C%22customer_type%22%3A%22Individual%22%2C%22customer_group%22%3A%22Default%20Customer%20Group%22%2C%22territory%22%3A%22Default%22%2C%22company%22%3A%22Comapny%22%7D%5D

regards
Ankit

On Wednesday, June 25, 2014 12:37:07 AM UTC+12, rushabh wrote:
Use the new API lib - its quite similar to the old one


--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+unsub...@googlegroups.com.

Anand Doshi

unread,
Jun 24, 2014, 9:38:38 AM6/24/14
to ERPNext Developer's Forum
Ankit,

Pass a json dict and not a list in data=

-Anand.


To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/63081e0a-b484-458e-b2ee-590de800bc50%40googlegroups.com.

Ankit

unread,
Jun 24, 2014, 9:41:20 AM6/24/14
to erpnext-dev...@googlegroups.com
Ok, I have managed to add the customer now.
Turns out [] brackets around the JSON string were causing that error.

Thank you for the help, I am working on invoice creation now.

Rushabh Mehta

unread,
Jun 24, 2014, 10:47:04 AM6/24/14
to erpnext-dev...@googlegroups.com
The JSON is changed too - make sure you put the items in list in the main doc - GET one invoice to check the structure



@rushabh_mehta

--
Note:
 
If you are posting an issue,
1. We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
2. Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
3. For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
 
End of Note
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages