with commit 49ab3649f9fc94ef88a1fbc4610c639d8e4bad5a you removed the "Save" method from CRMEntity.
Now you cannot use operation "create" with webservices, since it still calls "Save()". The related error message is e.g.
~
PHP Fatal error: Uncaught Error: Call to undefined method Accounts::Save() in /var/www/yeti/include/Webservices/VtigerCRMObject.php
~
How to work around?
WebService is removed from the system.
To communicate with the system, use the API.
https://github.com/YetiForceCompany/YetiForceCRM/tree/developer/api
..which is called webservice.
Is there any documentation or example on how to use this?
currently it seems i can't see CRUD operation on new webservice api,
will you implement it in the future?
It could be that the operation are only permitted from the customer portal webservice,
a manual to use it would be interesting.
Portal is able to "put" some stuff - seems to be the new create.
I've managed to connect via script to the service and to authenticate.
Still re-engineering to get and send data...
Check portal2 he uses the new API
https://github.com/YetiForceCompany/YetiForcePortal2
Can you guys do some basic form connecting to YF as a start point sample?
@waran70
Simple REST calls. You need the rewrite rules from crm .htaccess running.
~~~
============ Request
REQUEST_METHOD: POST
Headers:
HOST : yeti.local
AUTHORIZATION : Basic cG9ydGFsc3J2OnAvcnRhbHBhc3M=
USER-AGENT : php-requests/1.6.1
ACCEPT : /
ACCEPT-ENCODING : deflate, gzip
REFERER : http://yeti.local/api/webservice/Users/Login
CONTENT-TYPE : application/json
X-ENCRYPTED : 0
X-API-KEY : TDmqFYoPJLzIXZCxcFjuyOBr3vUVhi9N
CONTENT-LENGTH : 162
----------- Request data -----------
Array
(
[userName] => [email protected]
[password] => test
[params] => Array
(
[version] => 0.0.2
[language] => en_us
[ip] => client.local
[fromUrl] => http://portal.local/
)
[module] => Users
[action] => Login
)
------------- Response
Status: 200
Headers:
----------- Response data -----------
Array
(
[status] => 1
[result] => Array
(
[token] => 61b2d1755f2aeb5134b980303c6868b8
[name] =>
[parentName] =>
[lastLoginTime] =>
[lastLogoutTime] =>
[language] => en_us
[type] => 1
[logged] => 1
)
)
~~~
To have communication like this you can use the php's curl commands.
For now there is no list with the allowed and possible modules and action (and their parameters).
Check it: api/webservice/Methods
...and the answer is
~json
{
"status": 1,
"result": {
"Users": {
"api\/webservice\/Users\/Login": "POST",
"api\/webservice\/Users\/Logout": "PUT"
},
"BaseAction": {
"api\/webservice\/Methods": "GET",
"api\/webservice\/Modules": "GET"
},
"BaseModule": {
"api\/webservice\/__MODULE_NAME__\/RecordsList": "GET",
"api\/webservice\/__MODULE_NAME__\/Privileges": "GET",
"api\/webservice\/__MODULE_NAME__\/Record": "GET,DELETE,PUT",
"api\/webservice\/__MODULE_NAME__\/Fields": "GET",
"api\/webservice\/__MODULE_NAME__\/Hierarchy": "GET"
}
}
}
~
If anyone wants to check it, here a curl command (from command line) for that request. (Attention: the user, password, api-key and token must be replaced based on your system)
~bash
curl -i --user portaluser:portalpass -H Accept:application/json -H X-API-KEY:TDmqFYoPJLzIXZCxcFjuyQBr3vUVhi9N -H X-ENCRYPTED:0 -H X-Token:b71fc96667bb191e1db9ff32a2fb9f6f -X GET http://yeti.local/api/webservice/Methods
~
to test the webservice may be used postman for chrome
... and here a list of possible modules:
~
[Contacts] => Contacts
[Accounts] => Accounts
[Leads] => Leads
[Documents] => Documents
[Calendar] => Calendar
[HelpDesk] => Tickets
[Products] => Products
[Faq] => FAQ
[Vendors] => Vendors
[PriceBooks] => Price Books
[Campaigns] => Campaigns
[PBXManager] => List of calls
[ServiceContracts] => Service Contracts
[Services] => Services
[Assets] => Assets
[ProjectMilestone] => Project milestones
[ProjectTask] => Project tasks
[Project] => Projects
[OSSTimeControl] => Time Control
[OSSMailView] => Corporate emails
[OSSOutsourcedServices] => Outsourced Services
[OSSSoldServices] => Sold Services
[OutsourcedProducts] => Outsourced Products
[OSSPasswords] => Passwords
[OSSEmployees] => Employees
[CallHistory] => Call history
[Ideas] => Ideas
[HolidaysEntitlement] => Annual holiday entitlement
[PaymentsIn] => Payments in
[PaymentsOut] => Payments out
[LettersIn] => Letters incoming
[LettersOut] => Letters outgoing
[Announcements] => Announcements
[Reservations] => Reservations
[SQuoteEnquiries] => Sales enquiries
[SSalesProcesses] => Opportunities
[SRequirementsCards] => Sales requirements
[SCalculations] => Calculations
[SQuotes] => Quotes
[SSingleOrders] => Sales Orders
[SRecurringOrders] => Recurring Sales Orders
[Partners] => Partners
[Competition] => Competition
[FBookkeeping] => Bookkeeping
[FInvoice] => Invoices
[KnowledgeBase] => KnowledgeBase
[IStorages] => Storages
[IGRN] => Goods Received Note
[FInvoiceProforma] => Proforma invoices
[IGDN] => Goods Dispatched Note
[IIDN] => Internal Delivery Notes
[IGIN] => Goods Issued Note
[IPreOrder] => Pre-order
[ISTDN] => Storage Transfer Dispatched Notes
[ISTN] => Storage Turnover Notes
[ISTRN] => Storage Transfer Received Notes
[FCorectingInvoice] => Correcting Invoices
[IGRNC] => Goods Received Notes Corrections
[IGDNC] => Goods Dispatched Notes Corrections
[Notification] => Notification
[Orgaphonplanung] => ORGAPHON Planung
[EmailTemplates] => Email templates
[CFixedAssets] => Fixed assets
[CInternalTickets] => Internal tickets
[FInvoiceCost] => Invoices cost
[CMileageLogbook] => Mileage log book
[SVendorEnquiries] => SVendorEnquiries
)
~
unfortunately "ModComments" is missing - no more possibility to add comments?
You can add comments in v4.0.
It’s not on the list because it’s not visible in the menu. Adding comments works the same way adding records does.
@paula-w: So RecordList should also work with ModComments? actually it does not - however RecordList is a bad idea, since it always returns every record.
Have you ever tested with some > 10.000 records?
Api is not over yet.
Comments will be available as a crm which always relate to a specific record. without it you can not be their load.
I added the parameters X-ROW-LIMT and X-ROW-OFFSET, this should improve performance.
yes, thank you.
One more thing: could you add the field names, that should be returned?
Please don't get me wrong. I want to help to improve the API - its not just critics. As stated above and in other ticket, I've some (minor) code improvements.
Will you accept PR's?
Is there interest for a simple demo php and API access class to demonstrate how to use Yetiforce API?
If yes, I could publish them in my github repo.
I've applied latest commits for POST of new records but cannot get it running. "module" is not set so SAVE fails. See "public function getModule($raw = true)" in include/http/Request.php around line 284. Where should $this->module come from?
One more thing: could you add the field names, that should be returned?
Added, an example of usage below.

Please don't get me wrong. I want to help to improve the API - its not just critics. As stated above and in other ticket, I've some (minor) code improvements.
Thanks for the suggestions, we know what is missing in the API and what to add. First, our customers are served and and then add what he wants the community.
Will you accept PR's?
We are happy to accept the pull requests, we hope and look forward to helping communities in the development of YT.
Is there interest for a simple demo php and API access class to demonstrate how to use Yetiforce API?
If yes, I could publish them in my github repo.
Yes, we are interested in, we have no place for such scripts. https://github.com/YetiForceCompany/YetiForceScripts
I've applied latest commits for POST of new records but cannot get it running. "module" is not set so SAVE fails. See "public function getModule($raw = true)" in include/http/Request.php around line 284. Where should $this->module come from?
New bug new issue, it is necessary to keep order. Will need more description to be able to see it.
how to get token key?
settings -> integration -> web service application
I thought it was api :) so how to get api key
please help me

you have to create
1.) settings -> integration -> web service application (remember the name for next step
2.) settings -> integration -> web service users
Here use the name from step 1 and create a user (type map to user) _and_ map that user to an existing user, e.g. admin.
@migoi @mariuszkrzaczkowski . Hi, how can I add a module ? I sent a GET request to /api/webservice/Modules, got status 200 but response is empty.

Have a look:
https://github.com/YetiForceCompany/YetiForceScripts/tree/master/YetiREST
This a sample REST class and a demo. It should be pretty self explaining.
But: you cannot add a module on that way. All modules, that could be used are already in YetiForce.
Example if $module is 'Accounts' - this would add a new account with 'Foobar' as name:
~php
// create new record
$recorddata = array(
'accountname' => 'Foobar',
'active' => 1,
'assigned_user_id' => $yr->userId, // preset current users id based on login information
);
echo 'create new record';
$response = $yr->createRecord($module, $recorddata);
print_r($response); // return the id of the new record
echo '********'.PHP_EOL.PHP_EOL;
~
Hi! @migoi I have a question. When updating one record, are there some ways to send a request outside?
you want YetiForce to send (emit) a request on changing / adding a record via webgui?
Can you point me to the right direction i am trying to log in but cannot get past this stage .
I am passing username and password using Basic Auth.


New problem new issues
@mariuszkrzaczkowski thanks you have already helped me with this one on the case below.
For basic connection to the api use the code found here https://github.com/YetiForceCompany/YetiForceCRM/issues/4442
I am able to create new records check code below in this example i used Leads module
Also note assigned_user_id no longer uses this prefix 19xnumber it just uses number
and your data must be an array named "recordData" and then json_encoded.
$fields = array('recordData' => array('salutationtype'=> $data['subject'], 'leads_relation' => 'B2C', 'leadsource'=> 'Web Site', 'lastname' => $data['lastname'], 'assigned_user_id' => '8', 'description' => $data['message'], 'phone' => $data['phone'], 'email' => $data['email'], 'company' => $data['name'], 'website' => 'http://www.imagine.co.za', 'noapprovalcalls' => 1, 'noapprovalemails' => 1, 'active' => 1) );
$data_json = json_encode($fields);
$token = 'YOUR TOKEN';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'CRM URL/api/webservice/Leads/Record');
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "API USERNAME:API PASSWORD");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"x-api-key: API KEY",
"x-token: $token",
'Content-Type: application/json',
'Content-Length: ' . strlen($data_json)
)
);
$curl_response = json_decode(curl_exec($ch), true);
//Your log out method
//$this->logout();
curl_close($ch);
I test add record by postman but not ok, please help me!!
In other hand, i have a question about page spilit in api get list records: how to user X-ROW-OFFSET and X-ROW-LIMIT ? I had changed the value of X-ROW-OFFSET but no change effect

take a look in the log files in cache/logs/
There should be more information what's behind that "internal server error 500".
Thanks, i had check my error log and fix it. In other hand, i have a question about page spilit in api get list records: how to user X-ROW-OFFSET and X-ROW-LIMIT ? I had changed the value of X-ROW-OFFSET but no change effect?
limit will be the number of records returned. Offset the "starting record".
You put that information in the header section of your request:
~
...
X-ROW-LIMIT: 20
X-ROW-OFFSET: 100
...
~
Below seems to not work with new API... maybe I am wrong. Can you post here full script what will create below user in Accounts module?
// create new record $recorddata = array( 'accountname' => 'Foobar', 'active' => 1, 'assigned_user_id' => $yr->userId, // preset current users id based on login information ); echo 'create new record'; $response = $yr->createRecord($module, $recorddata); print_r($response); // return the id of the new record echo '************************'.PHP_EOL.PHP_EOL;
Below seems to not work with new API
what version?
5.1.84?
5.1.0 ?