ERPNext Integration with other Apps

hi,

ERPNext connect to other Apps via rest api.
to make request to this rest api, we have to hit login rest api which return token.

this token has expired within 24 hours.
this token is part of request header on each request.

how to achieve this kind of scenario in ERPNext?

do we have to create custom doctype to save token?

if we use for example webhook in purchase order doctype, how to update header request if token is expired?

thanks

You can use a service user account to achieve this. Create a user and give it the necessary permissions. Generate API Key and Secret for that user and you can pass the key and secret in your header. this does not expire unless the secret is changed/renegerated.

1 Like

hi,

the token comes from other Apps, not comes from ERPNext.

ERPNext post request json data to other Apps

thanks

You can either use frappe script API methods and pass the key in that:

https://frappeframework.com/docs/v14/user/en/desk/scripting/script-api#api

Or use webhooks:

https://frappeframework.com/docs/v14/user/en/guides/integration/webhooks

Both methods allow for headers where you should be able to enter the authorization parameters.

hi

is it possible to execute “frappe.make_post_request” inside python file?