Closed Sasamous closed 4 years ago
https://github.com/YetiForceCompany/YetiForceScripts/tree/master/YetiREST
Thank you, this is very useful! I have just some questions to ask.
I undestood I must create a WebService Application from YetiForce, in the field "URL" what I have to put?
"$host = 'https://gitdeveloper.yetiforce.com/';" must be replace with my standard YetiForce address? e.g. "https//10.0.0.XX/" (local address while in develop)
"$baseurl;" where forward?
In the example "https://gitdeveloper.yetiforce.com/webservice/Users/Login", the word "webservice" must be replaced with the name of my application? e.g. "https://10.0.0.XX/YetiConnector/User/Login? I tried to ping links like this but I had only 404 errors.
Thank you in advance 😄
How to set up API:
First you need to create a web service application Integration -> Web Service application and Add key
URL is just for you to know where are you accessing from, it does not matter. name and password is what you will use as basic auth as username and password.
then create a webservice user the user and password you create there you have to add it in the body as this
and lastly copy the token
in the webservice application with the copy button next to the edit one and add it like this
tadaaaaa
Thank you @javjim but doesn't work 😞
invalid URL CRM_URL/webservice/Users/Login
Yep, looks like after this, you need to first use Users/Login, and it will give you back a Token, that you need to add as a header with x-token:value and then you should be able to do stuff
invalid URL CRM_URL/webservice/Users/Login
I did 2 attempts
show me your yetiforce web app and web users..
show me your yetiforce web app and web users..
try with https://URL/webservice.php?module=Users&action=Login
This return something
The same result is returned also with "https://URL/webservice.php", which webservice should be activated? In webapplication it is active
you need to activate it in config/Api.php
https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/tests/setup/Api.txt#L20-L21
There was enabled only dav, I just changed with dav and webservice and now it answer "Wrong credentials", I tried with my YetiForce login credentials and with WebService User credentials but same situation.
Ok, credentials are
now the problem is "Internal Server Error":
where can I find a log or some suggestions to fix this problem?
I'm following the issue. I got the same problem Internal Server Error when trying to execute login call
show the body tab
show the body tab
This is the body tab
I tried API call with Demo server, it works, the login return to me the token, so maybe the problem is in my server, how can I find where is this problem?
change to form-data instead of x-www-formurlencoded
sorry, don't know what to tell you, verify all the steps, that is how I have it and it works properly, did you use the test and test123 username and password too? or you are just copying mine?
I created and used test and test123 in my Webservice Users.
I understood how it works, I tried call with the Demo server, the problem is, how can I set my YetiForce installation to answer as Demo server? I installed YetiForce correctly, following all steps and configuring my server as YetiForce requirement page ask. Maybe I have to activate something else?
looks like you have a server configuration problem
looks like you have a server configuration problem
where can I see this?
No sorry, I was asking: where can I check to find the problem on my configuration? Some logs? Some pages?
check all log logs: apache FPM php crm
I can't find any useful information by logs. I installed the last version of YetiForce (5.2), I created an application an user for that application, I get the exactly same problems:
The server configuration:
opcache.interned_strings_buffer can't be more than 52 else page doesn't answer output_buffering is set On in both configurations but appears 1 and empty on configuration page
enable showing errors: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/config/Debug.php#L88
enable showing errors: https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/config/Debug.php#L88
Response: {"status":0,"error":{"message":"2: array_merge(): Argument #1 is not an array in \/var\/www\/html\/yetiforce\/api\/webservice\/Core\/Request.php, line 43","code":200}}
Code:
whats that x-encrypted? and also again, use form-data in body.
whats that x-encrypted? and also again, use form-data in body.
I don't know why it autochanges to x-www-form-urlencoded, btw ok, with form-data it works, thanks you :)
To close issue, I need to achieve just another answer, why works with ../"webservice.php?module=Users&action=Login" and not with "../webservice/Users/Login"?
How to get list record via api by sort order
@ezbank you can't, but you can add it easily and quickly like this https://github.com/YetiForceCompany/YetiForceCRM/blob/developer/api/webservice/Portal/BaseModule/RecordsList.php#L63L65
@Sasamous check if you have it turned on mod_rewrite
@mariuszkrzaczkowski
check this: #4154
Perfect, this worked, I had to enable "rewrite" from mods.
I used this commands:
a2enmod rewrite
systemctl restart apache2
Thank you all 😄
So, login return token, token is accept by other api calls, but it always return {"status":0,"error":{"message":"No permissions for module","code":403}}
, I tried to follow code flow and I reached this file: ../app/Privilege.php lines 91~95:
if (!Module::isModuleActive($moduleName)) {
static::$isPermittedLevel = 'SEC_MODULE_IS_INACTIVE';
\App\Log::trace('Exiting isPermitted method ... - yes');
echo (Module::isModuleActive($moduleName) ? "Enabled " : "Disabled ").$moduleName; //I added this code to check problem
return false;
}
So I get this when I try calls:
BaseAction seems to be disabled, how can I enable it?
Fixed 7d55a95 see now https://doc.yetiforce.com/api/#/BaseAction/Api%5CPortal%5CBaseAction%5CModules%3A%3Aget
Works on demo page, but I don't have "api" folder in "public_html" folder, I'm on 5.2-Complete
How can I solve on my installation?
I could just comment the return false;
and it works, but there is a better way? I don't want allow all requests without a filter
Cause I didn't solved my problem, I'm using demo Yetiforce for test API, but I get this error:
{"status":0,"error":{"message":"No permissions to view record","code":403,"backtrace":"#0 api\/webservice\/Portal\/BaseModule\/Record.php (62) >> Api\\Core\\Exception->__construct('No permissions to view record',403)\n#1 api\/webservice\/Core\/BaseAction.php (28) >> Api\\Portal\\BaseModule\\Record->checkPermission()\n#2 api\/webservice\/Controller.php (87) >> Api\\Core\\BaseAction->checkAction()\n#3 webservice.php (15) >> Api\\Controller->process()\n#4 public_html\/webservice.php (11) >> require('webservice.php')"}}
when I try to make this call: https://gitdeveloper.yetiforce.com/webservice.php?module=Vendors&action=Record&record=368
I'm using "demo@yetiforce.com" (administrator) user, all other calls I tried works
@mariuszkrzaczkowski
check if user api has permissions for this record
check if user api has permissions for this record
Yes, the user have permissions, with that user I can see the page
@mariuszkrzaczkowski User have premissions, I checked and modified my demo session in different ways, nothing helps, maybe is a bug for that module? By the way, how can I get this fix https://github.com/YetiForceCompany/YetiForceCRM/issues/11770#issuecomment-545848092 on version 5.2 (Complete)? Must I uninstall everything again and download a non-stable version to get a more working (but not completely working) API system?
2 things, use as different issue for different questions, also, that issue you have is the same I am having here right? https://github.com/YetiForceCompany/YetiForceCRM/issues/11841 can you add your info there
Yes, it is the same response but in Demo Environment I can get ../Contacts/Record/recordID, my problem is in ../Vendors/Record/recordID
Description
Hello, I can't find anywhere a documentation that say how to setup and use API, I'm about to create a connector between this CRM and an existing ERP system, but I don't know where to start from YetiForce.
I found just this partial documentation in other tickets, but isn't enough explicit.
Someone know a place where to find a documentation or can suggest me how to use YetiForce API?
Thank you in advance. 😄