vtiger CRM 二次开发接口Webservice调用实例

过程:

vtiger CRM 二次开发接口Webservice调用实例_第1张图片






网络调用过程:

GET /vtigercrm/webservice.php?operation=getchallenge&username=admin


HTTP/1.1 200 OK
Content-Type: application/json
{"success":true,"result":{"token":"5081cda1715be","serverTime":1350684065,"expireTime":1350684365}}


POST /vtigercrm/webservice.php
operation=login&username=admin&accessKey=a04xxxxxxxxxxxxxxxxxxxxxxxxxxxx


HTTP/1.1 200 OK
Content-Type: application/json
{"success":true,"result":{"sessionName":"26d6184e5081cda23c6de","userId":"19x1","version":"0.22","vtigerVersion":"5.3.0"}}


GET /vtigercrm/webservice.php?operation=listtypes&sessionName=26d6184e5081cda23c6de


HTTP/1.1 200 OK
Content-Type: application/json
{"success":true,"result":{"types":["Calendar","Leads","Accounts","Contacts","Potentials","Products","Documents","Emails","HelpDesk","Faq","Vendors","PriceBooks","Quotes","PurchaseOrder","SalesOrder","Invoice","Campaigns","Events","Users","PBXManager","Services","ServiceContracts","ModComments","SMSNotifier","Assets","ProjectMilestone","ProjectTask","Project","Groups","Currency","DocumentFolders","CompanyDetails"],"information":{"Calendar":{"isEntity":true,"label":"Calendar","singular":"To Do"},"Leads":{"isEntity":true,"label":"Leads","singular":"Lead"},"Accounts":{"isEntity":true,"label":"Accounts","singular":"Account"},"Contacts":{"isEntity":true,"label":"Contacts","singular":"Contact"},"Potentials":{"isEntity":true,"label":"Potentials","singular":"Potential"},"Products":{"isEntity":true,"label":"Products","singular":"Product"},"Documents":{"isEntity":true,"label":"Documents","singular":"Document"},"Emails":{"isEntity":true,"label":"Email","singular":"Email"},"HelpDesk":{"isEntity":true,"label":"Trouble Tickets","singular":"Ticket"},"Faq":{"isEntity":true,"label":"FAQ","singular":"Faq"},"Vendors":{"isEntity":true,"label":"Vendors","singular":"Vendor"},"PriceBooks":{"isEntity":true,"label":"Price Books","singular":"PriceBook"},"Quotes":{"isEntity":true,"label":"Quotes","singular":"Quote"},"PurchaseOrder":{"isEntity":true,"label":"Purchase Order","singular":"Purchase Order"},"SalesOrder":{"isEntity":true,"label":"Sales Order","singular":"Sales Order"},"Invoice":{"isEntity":true,"label":"Invoice","singular":"Invoice"},"Campaigns":{"isEntity":true,"label":"Campaigns","singular":"Campaign"},"Events":{"isEntity":true,"label":"Events","singular":"Event"},"Users":{"isEntity":true,"label":"Users","singular":"User"},"PBXManager":{"isEntity":true,"label":"PBX Manager","singular":"SINGLE_PBXManager"},"Services":{"isEntity":true,"label":"Services","singular":"Service"},"ServiceContracts":{"isEntity":true,"label":"Service Contracts","singular":"Service Contract"},"ModComments":{"isEntity":true,"label":"Comments","singular":"Comment"},"SMSNotifier":{"isEntity":true,"label":"SMSNotifier","singular":"SMS Info"},"Assets":{"isEntity":true,"label":"Assets","singular":"Asset"},"Project Milestone":{"isEntity":true,"label":"Project Milestones","singular":"Project Milestone"},"ProjectTask":{"isEntity":true,"label":"Project Tasks","singular":"Project Task"},"Project":{"isEntity":true,"label":"Projects","singular":"Project"},"Groups":{"isEntity":false,"label":"Groups","singular":"Groups"},"Currency":{"isEntity":false,"label":"Currency","singular":"Currency"},"DocumentFolders":{"isEntity":false,"label":"DocumentFolders","singular":"DocumentFolders"},"CompanyDetails":{"isEntity":false,"label":"CompanyDetails","singular":"CompanyDetails"}}}}


GET /vtigercrm/webservice.php?operation=describe&elementType=HelpDesk&sessionName=26d6184e5081cda23c6de




HTTP/1.1 200 OK
Content-Type: application/json
{"success":true,"result":{"label":"Trouble Tickets","name":"HelpDesk","createable":true,"updateable":true,"deleteable":true,"retrieveable":true,"fields":[{"name":"ticket_no","label":"Ticket No","mandatory":false,"type":{"name":"string"},"nullable":false,"editable":false,"default":""},{"name":"assigned_user_id","label":"Assigned To","mandatory":true,"type":{"name":"owner"},"nullable":false,"editable":true,"default":"0"},{"name":"parent_id","label":"Related To","mandatory":false,"type":{"refersTo":["Accounts","Contacts"],"name":"reference"},"nullable":true,"editable":true,"default":""},{"name":"ticketpriorities","label":"Priority","mandatory":false,"type":{"picklistValues":[{"label":"Low","value":"Low"},{"label":"Normal","value":"Normal"},{"label":"High","value":"High"},{"label":"Urgent","value":"Urgent"}],"defaultValue":"Low","name":"picklist"},"nullable":true,"editable":true,"default":""},{"name":"product_id","label":"Product Name","mandatory":false,"type":{"refersTo":["Products"],"name":"reference"},"nullable":true,"editable":true,"default":""},{"name":"ticketseverities","label":"Severity","mandatory":false,"type":{"picklistValues":[{"label":"Minor","value":"Minor"},{"label":"Major","value":"Major"},{"label":"Feature","value":"Feature"},{"label":"Critical","value":"Critical"}],"defaultValue":"Minor","name":"picklist"},"nullable":true,"editable":true,"default":""},{"name":"ticketstatus","label":"Status","mandatory":true,"type":{"picklistValues":[{"label":"Open","value":"Open"},{"label":"In Progress","value":"In Progress"},{"label":"Wait For Response","value":"Wait For Response"},{"label":"Closed","value":"Closed"}],"defaultValue":"Open","name":"picklist"},"nullable":true,"editable":true,"default":""},{"name":"ticketcategories","label":"Category","mandatory":false,"type":{"picklistValues":[{"label":"Big Problem","value":"Big Problem"},{"label":"Small Problem","value":"Small Problem"},{"label":"Other Problem","value":"Other Problem"}],"defaultValue":"Big Problem","name":"picklist"},"nullable":true,"editable":true,"default":""},{"name":"update_log","label":"Update History","mandatory":false,"type":{"name":"text"},"nullable":true,"editable":true,"default":""},{"name":"hours","label":"Hours","mandatory":false,"type":{"name":"integer"},"nullable":true,"editable":true,"default":""},{"name":"days","label":"Days","mandatory":false,"type":{"name":"integer"},"nullable":true,"editable":true,"default":""},{"name":"createdtime","label":"Created Time","mandatory":false,"type":{"name":"datetime"},"nullable":false,"editable":false,"default":""},{"name":"modifiedtime","label":"Modified Time","mandatory":false,"type":{"name":"datetime"},"nullable":false,"editable":false,"default":""},{"name":"ticket_title","label":"Title","mandatory":true,"type":{"name":"string"},"nullable":false,"editable":true,"default":""},{"name":"description","label":"Description","mandatory":false,"type":{"name":"text"},"nullable":true,"editable":true,"default":""},{"name":"solution","label":"Solution","mandatory":false,"type":{"name":"text"},"nullable":true,"editable":true,"default":""},{"name":"id","label":"ticketid","mandatory":false,"type":{"name":"autogenerated"},"editable":false,"nullable":false,"default":""}],"idPrefix":"9","isEntity":true,"labelFields":"title"}}


POST /vtigercrm/webservice.php
operation=create&format=json&sessionName=26d6184e5081cda23c6de&elementType=HelpDesk&element=%7B%22ticketpriorities%22%3A%22Low%22%2C%22ticketseverities%22%3A%22Minor%22%2C%22ticketstatus%22%3A%22Open%22%2C%22ticketcategories%22%3A%22Big%20Problem%22%2C%22ticket_title%22%3A%22my%20ticket%20001%E4%B8%AD%E6%96%87002%22%2C%22assigned_user_id%22%3A%2219x1%22%7D


HTTP/1.1 200 OK
Content-Type: application/json
{"success":true,"result":{"ticket_no":"TT4","assigned_user_id":"19x1","parent_id":"","ticketpriorities":"Low","product_id":"","ticketseverities":"Minor","ticketstatus":"Open","ticketcategories":"Big Problem","update_log":"","hours":"0","days":"0","createdtime":"2012-10-19 22:01:42","modifiedtime":"2012-10-19 22:01:42","ticket_title":"my ticket 001\u4e2d\u6587002","description":"","solution":"","id":"9x6"}}



参考资料:

Webservices tutorials

vtiger CRM Webservices 

vtiger CRM plugin for firefox 5.3版本

你可能感兴趣的:(webservice,crm,calendar,Integer,reference,events)