REST Client inside BPM

I am considering using a BPM as an event to call AWS to do some stuff.
It sounds like Epicor is potentially planning making a REST Caller node within the BPM framework, but for now I was just planning on writing my own.

Is there a preferred way to write a REST client within a BPM or should I just use the native .NET API for this?

I use RestSharp just bring the DLL into your Externals. Works great

I assume you then only need to put those files on the server?

Yeah just on the External Folder

Ahh didn’t even know that existed :slight_smile: How to do you manage upgrades with external dependencies? I am only a little concerned that if we upgrade it would re-write the contents of that folder.

It does not, that folder is safe. And as long as the DLL’s in tehre don’t depend on epicor (they shouldn’t) then you never have to touch them.

2 Likes

Awesome, thanks man

Here’s what it looks like.

5 Likes

Awesome, thank you for sharing!!!

@Aaron_Moreng, are you bringing information back into epicor? How are you doing it? Basically where is your BPM? and are you calling your update in custom code?

I’m actually just working on this as we speak. In this case, I’m not writing back to Epicor from the response (pulling files down from S3 to file server and then updating an Epicor rec), but I can provide you with an example webhook that I’ve used in the past.

This code POSTs data, but you could use it for a GET as well.

You could read the response of the StreamReader and then write back to Epicor from there.

I’ve got the write from Epicor to my external. I just need/want to store the response. Since I’m on a standard DD, I don’t have any helpers there and far as writing to tables. I was just wondering if you had tackled that. Or had your code in a place that handle the writing a little easier.

You could store the response in a UD character field:

Are you asking about how to write a record to a table within a BPM?

Yes. I’m assuming you would just code it? Linq or something?

This is a good example of writing a new record to a UD table from inside a BPM.
Replace the json variable with either your response string or I suppose you could leave it serialized. Whatever works best!
image

2 Likes

This case it would be an extended UD field on job head. I’ll figure out how to do that. I was just wondering if you had worked out a little easier approach.

This is the easiest way I’ve found :wink:

1 Like