Fetch API data into ERPNEXT

I would like to know how I can fetch information from other software into ERPNext.

Other software provides access to their API via 2 methods
1 - Using session cookies (see “session” URL path)
2 - Basic access authentication - Wikipedia

Right now I am able to fetch information using the below mentioned code in a situation where ERPNext is not involved.

type: ‘get’,
url: ‘http://ipaddress:port/api/category/subcategory’,
headers: {
“Authorization”: "Basic " + btoa(“username” + “:” + “pwd”)
success: function (response) {
parameter1= response[0][“parameter1”];
parameter2= response[0][“parameter2”];


What should I be doing to get this information into a doctype.

I dont mean to store this information, I just want to get the data and display it for now.

Thank You,

I dont see anything wrong in your approach. After you get the data from the API request, you can send it to a whitelisted method where it can be saved into a doctype using the frappe ORM.

Check out how to use a whitelisted method here:

Thanks for the help,

still learning ERPNext, please help me understand frappe ORM.

The Frappe ORM/ODM is basically defined in frappe.database (usually called with frappe.db).

A word of caution here is that understanding these methods will help you access and write data, but not what the models look like or how they’re intended to function (both programmatically and in the business sense); that’s largely isolated to each model/ doctype. For an experienced programmer, the Frappe tutorial is a real eye opener because it’s a well designed example case.