Espocrm apiKey is null please help me.....?
Espocrm apiKey is null
Collapse
X
-
Hi guys, I'm trying to learn how to use API at the moment, see if I can do anything out of it in the future.
Anyway having trouble at this stage, just using URL as a learning trial-and-error, then slowly learn more advance usage.
But what is the correct URL to use? I followed the documentations but still bit unclear how to get started. I can use Get (if I logged in) but I want to be able to use my API key to automated login (without popup). https://docs.espocrm.com/development/api/
(example below, i use my real URL for these test)
https://demo.espocrm.com/api/v1/Cont...43ca033f7ab4c5
I have tried this:
https://demo.espocrm.com/api/v1/?apikey=secretAPIkeyhere&Contact/contactID
https://demo.espocrm.com/api/v1/?X-Api-Key=secretAPIkeyhere&Contact/contactID
https://demo.espocrm.com/api/v1/?api=secretAPIkeyhere&Contact/contactID
What is the correct URL to use? If I just use: https://demo.espocrm.com/api/v1/Cont...43ca033f7ab4c5 when I'm not logged in, it will popup with "please login", after logging in I can see all the API response. Just having issue with API key URL formatting location -
Looking around more I found that this is how API key get used, not sure if it the same as the normal one but I created a Web-to-Lead or a Lead Capture Entry point. See:
After making that Entry Point I got the URL code like so:
https://demo.espocrm.com443/api/v1/L...cretAPIKeyhere
So it look like the API key just get append at the end, but if I were to open that URL it still ask for an account/password. Is this normal or I'm testing it wrong.
Since I'm using Demo API Key I think it alright to paste here.
https://demo.espocrm.com:443/api/v1/...5c38b04a97db1/
Also tried variation such as:
https://demo.espocrm.com:443/api/v1/...5c38b04a97db1/
Which what most tutorial/website use, ?api_key
---- UPDATE
OK, I finally manage to make some progress, a good sign finally appear as I delve into learning this API system, hopefully can make use of it later and if anyone who have zero knowledge of it can learn it with me also. I will skip over all the reference (guide, tutorial, learning that I acquire) and jump straight into what to do to get started.
First I use the Software Isomnia https://insomnia.rest/download/
This software is so I can start learning and testing API without jumping into programming and code yet.
With my previous post I'm constantly having problem with API key, it still asking for Username/Password. Maybe if it is a PHP script you can bypass this issue? I don't know. Anyway this problem is solved as follow. Download Isomnia and open Isomnia.
Create a new Project (Ctrl+N)
Click on "Authorization", choose Basic, type in your username and password.
Next to where it say "GET", write in your website URL, for example: https://demo.espocrm.com/api/v1/account
Click "Send"
Wait a bit, on the right of all your account.
Next we give a "Post" a try. A "Get" is similar to "Hey, can you give me this?", whereas a "Post" is similar to "Create this for me"
So we will "Post" a new Account record using API. Where the button next to the URL is (GET), click on that and choose Post.
Then click on "JSON", then you can paste the example in documents. For example: https://docs.espocrm.com/development...ccount/#create
{ "name": "Test", "assignedUserId": "someUserId" }
Click "Send". If not error, and you get a status 200 that mean it work. Now refresh your Account in your EspoCRM, you should see a new Account name, "Test" assigned to an username "someUserID".
Congratulations, you are now no longer a newbie like I was previously.
Next I will slowly learn more about these commands, refer to them here:
At this stage I'm still trying to figure out how to test this one since the example is in PHP
Last edited by esforim; 07-03-2020, 08:37 AM.Comment
-
This is how an API call is made: (taken from the documentation)
https://address_of_your_crm/api/v1/C...43ca033f7ab4c5
Try these resources to learn about API:
https://forum.espocrm.com/forum/deve...46-api-example
https://github.com/espocrm/documenta...lopment/api.md
You can check the helper class EspoApiClient.php in the documentation to see how the API key is sent, it is part of the headerLast edited by telecastg; 07-03-2020, 08:34 AM.Comment
Comment