What exactly are you having problems with? The execution of the REST endpoints or the sequence of events in ERPNext, or the fields you’d like to refer/update?
Rather show a portion of your code so people can help.
If it’s the REST invocation, then have a look at [Tutorial] Using cURL for REST and RPC API calls