Hello EpiUsers,
Background:
I have been developing a small webhook catcher for order entry for my company. The end goal is to catch new orders and automatically input them into epicor as they come. So far I have:
- Authenticated with shopify and epicor
- Caught and formatted the shopify data
- Created a new SO header from shopify data using: api/v1/Erp.BO.SalesOrderSvc/SalesOrders
So right now every order is creating a header with shipping info and its fully automated and I’m proud of my novice accomplishments and life is good! The next step is to add order lines to the header I’ve created. I’ve isolated OrderNum from the return of the SalesOrders method to use in the creation of the order lines.
I had help from this forum when getting the SalesOrders method to work: Rest PHP multi-company Creating Order Company B Erp.BO.SalesOrderSvc/SalesOrders
Recent Thread
I was recently attempted to make the lines with api/v1/Erp.BO.SalesOrderSvc/OrderDtls. The return error was odd and after some help from this forum decided to try a different method. If you want to see that background the link is: Rest API 1000 SO Limit SalesOrderSvc/OrderDtls
Current Attempt
The above threads and this tracelog lead me to try a new method from the swagger site: <tracePacket> <businessObject>Erp.Proxy.B2O.SalesOrderImpl</businessObject> - Pastebin.com
My new Rest call to api/v1/Erp.BO.SalesOrderSvc/GetNewOrderDtl is throwing some new errors. I am having a difficult time trying to format the post fields properly. I presume I could be failing because I have a lack of understanding regarding the “CallSettings” header, or I am just formatting the json improperly. Something to do with the “ds” array or “OrderHed”.
I have attempted a bunch of formats and have been fairly unsuccessful. I will post 2 examples with the error i receive.
Testing Code
response: BadRequest REST API Exception Parameter ds is not found in the input object Epicor.RESTApi.ErrorHandling.ApiException
CURLOPT_POSTFIELDS => ‘{
“CustNum”: 3,
“OrderNum”: "’ . $OrdNum . ‘",
“SellingQuantity”: “1”,
“PartNum”: “KYV100FBA”}’,
After getting the above response from the above code I looked at the swagger format and saw there was a “ds”:{“OrderHed”:[{… before the normal post fields I had worked with on previous successes. I attempted to update it with the below code and received the below response.
response: BadRequest REST API Exception Parameter orderNum is not found in the input object Epicor.RESTApi.ErrorHandling.ApiException
CURLOPT_POSTFIELDS => ‘{
“ds”: {
“OrderHed”: [{
“CustNum”: 3,
“OrderNum”: "’ . $OrdNum . ‘",
“SellingQuantity”: “1”,
“PartNum”: “KYV100FBA”}]}}’,CURLOPT_HTTPHEADER => array( "Authorization: Basic " . $auth, "Accept: application/atom+xml", "Cache-Control: no-cache", "Content-Type: application/json", 'CallSettings: {"Company":"25558B"}', "Top: 1000" )
Expanding my code
I tried following the format at swagger and added to the structure putting in the correct information… but no matter what I get the “no orderNum found” response. The structure looks something like this:
{ "ds": { "OrderHed": [ { "Company": "25558B", ... } ], "OrderHedAttch": [ { "Company": "25558B", ... } ], "OHOrderMsc": [ { "Company": "25558B", ...
The format goes on like that forever. But in DMT it just requires 4 fields be posted in. I’m sure by now some of you are seeing a million glaring mistakes. Please enlighten me.