Good Day
We have a PHP Company website and would like to know what best way to read data from ERPNext to display on website via restapi?
Is this wrapper i can use:
Or there better way as i see this was updated 4 years back.
Thank You
Albertus Geyser
1 Like
manikk
February 22, 2019, 6:37am
2
You can hit the ERPNext - api directly from javascript itself. Or if you would like to user php, you can use Guzzle to connect to the frappe/ERPNext api. Please refer for more info about the api and how to connect to it- Introduction
1 Like
Thank You
Will check it out and if you do not mind ask questions here.
manikk
February 22, 2019, 6:41am
4
Sure. No problem. Cheers.
manikk:
Guzzle
Do not have any javascript example code i can go through to understand better?
Thank You
Would be great if i can see how to login and do get and post if possible.
Thank You
manikk
February 22, 2019, 7:30am
7
Please refer - Token based authentication
Let me know, if you are still struggling, I will help you in connecting to the api.
Good Day
I tried the following Simple Authentication:
var request = $.ajax({
url: āhttps://xxx.xxx.xxx.xxx/api/method/login ā,
type: āPOSTā,
data: { usr: āUsernameā, pwd : āPasswordā} ,
contentType: āapplication/jsonā
});
request.done(function(data) {
alert(āDoneā);
});
request.fail(function(jqXHR, textStatus) {
alert(āFailedā);
});
But fails.
Any help?
Thank You
Good Day
I tried the following without any success:
$.ajax({
url: āhttp://xxx.xxx.xx.xx/api/method/login ā,
method: āPOSTā,
data: {usr: āUserā, pwd : āPasswordā},
dataType:ājsonā,
contentType: āapplication/jsonā,
accepts:āapplication/jsonā,
success: function(data) {
alert(data);
},
error: function(data, errorThrown){
alert("Login " + errorThrown);
}
});
Good Day
Still nobody that did this before?
I really need help regarding javascript + RestAPI.
Thank You
Albertus Geyser
where should upload php files from other sites?