# Epicor Function for API - First Attempt!

**URL:** <https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627>\
**Category:** Kinetic ERP\
**Created:** [September 22, 2022, 7:41pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627 "2022-09-22T19:41:59Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [September 22, 2022, 7:41pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/1 "2022-09-22T19:41:59Z")

</div>

I am attempting to create a Function to be used as an API. This is my very first attempt and am failing miserably. I think it is because I am lazy and don’t want to do to much work that might end up being unnecessary.

With that said, my question is do I have to trace a transaction in the system and then replicate ALL of the method calls?

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [September 22, 2022, 7:46pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/2 "2022-09-22T19:46:25Z")

</div>

> [@jkane](#):
>
> With that said, my question is do I have to trace a transaction in the system and then replicate ALL of the method calls?

Generally, yes.

\*\* I say generally because sometimes you can get away with not calling some. Couldn’t tell you which–you’ll have to discover that on your own. If you’re just starting out, you should just replicate them all.

Here’s an example I’m working on with Inventory Transfer. The red ones I’m skipping.

 ![image](https://www.epiusers.help/uploads/default/original/3X/3/4/3463f172596a5ec8eadf3e8a9ff2beb0c853e398.png)

---

<div class="post-metadata">

**Author:** ![Mark\_Wonsil](https://www.epiusers.help/user_avatar/www.epiusers.help/mark_wonsil/32/51594_2.png) [@Mark\_Wonsil](https://www.epiusers.help/u/Mark_Wonsil)\
**Post date:** [September 22, 2022, 8:07pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/3 "2022-09-22T20:07:16Z")

</div>

+1 on what @hmwillett is saying.

Generally, the ones I don’t use are the calls to fill drop-down boxes or other UI-related purposes. An API won’t need those.

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [September 22, 2022, 8:15pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/4 "2022-09-22T20:15:01Z")

</div>

> [@hmwillett](#):
>
> Inventory Transfer

@jkane I might suggest don’t start with inventory transfer…

I made an EFx for that a few months ago. It’s a bear. I went totally rogue on that since the trace seems to leave out a lot of details.

Maybe start with something simpler…

But huzzah and you can do it!

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [September 22, 2022, 8:15pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/5 "2022-09-22T20:15:50Z")

</div>

You’re not wrong, lol.

Freaking deferred updates…

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [September 22, 2022, 8:16pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/6 "2022-09-22T20:16:49Z")

</div>

No, wait, I take that back - it was [issue material](https://www.epiusers.help/t/epicor-function-to-issue-and-return-material/93575).

Sorry, I did both around the same time. Inventory transfer might be fine.

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [September 22, 2022, 8:18pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/7 "2022-09-22T20:18:04Z")

</div>

> [@hmwillett](#):
>
> deferred updates

Oh, yeah that.

So yes @hmwillett if you do finish this, I would like to learn from it. I think we are still getting bit from that here.

---

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [September 22, 2022, 8:28pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/8 "2022-09-22T20:28:11Z")

</div>

> [@JasonMcD](#):
>
> Maybe start with something simpler…

I don’t know if Quote is simpler, but that’s what I’m starting.

---

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [September 22, 2022, 8:37pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/9 "2022-09-22T20:37:44Z")

</div>

Is it one big chain of Widgets or should I create a bunch of Functions in a single Library for each method?

So it would be one Function for creating the header, getting customer info, etc, and update. Then a second function for creating a line, etc.

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [September 22, 2022, 8:39pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/10 "2022-09-22T20:39:57Z")

</div>

Isn’t there a restriction where you can’t call a function from another function _in the same library_?

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [September 22, 2022, 8:40pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/11 "2022-09-22T20:40:24Z")

</div>

Just create one function to do the thing. All of the code or BO widgets can be in the single function. Then call the function as needed to do the thing.

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [September 22, 2022, 8:40pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/12 "2022-09-22T20:40:50Z")

</div>

Not anymore.  
You can also get around that using reflection if on a version that does.

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [September 22, 2022, 8:41pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/13 "2022-09-22T20:41:19Z")

</div>

And you can copy widgets from one function to another if needed. So if you wanted to test pieces and then assemble them.

---

<div class="post-metadata">

**Author:** ![jkane](https://www.epiusers.help/user_avatar/www.epiusers.help/jkane/32/57624_2.png) [@jkane](https://www.epiusers.help/u/jkane)\
**Post date:** [September 22, 2022, 8:50pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/14 "2022-09-22T20:50:16Z")

</div>

As always, you people are the best! I’m diving in 🏊🏻‍♂️

---

<div class="post-metadata">

**Author:** ![Hally](https://www.epiusers.help/user_avatar/www.epiusers.help/hally/32/1263_2.png) [@Hally](https://www.epiusers.help/u/Hally)\
**Post date:** [September 23, 2022, 12:13pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/15 "2022-09-23T12:13:27Z")

</div>

Start simple,

Test with Postman/ API help or similar,

Then build it up,

Save yourself some pain from having to publish/promote the function and use the staging address…Not at my PC to give you an exact example url.

There are some examples for calling the rest API in the online help, including an example web app.

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [September 23, 2022, 1:01pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/16 "2022-09-23T13:01:00Z")

</div>

https://{{host}}/{{epicor\_instance}}/{{FunctionAPIEndPoint}}/staging/{{Company}}/{{FunctionLibrary}}/{{Function}}

---

<div class="post-metadata">

**Author:** ![JasonMcD](https://www.epiusers.help/user_avatar/www.epiusers.help/jasonmcd/32/22326_2.png) [@JasonMcD](https://www.epiusers.help/u/JasonMcD)\
**Post date:** [September 23, 2022, 1:31pm UTC](https://www.epiusers.help/t/epicor-function-for-api-first-attempt/94627/17 "2022-09-23T13:31:37Z")

</div>

> [@Hally](#):
>
> Save yourself some pain from having to publish/promote the function and use the staging address

YES!
