Rest API 1000 SO Limit SalesOrderSvc/OrderDtls


I recently successfully added my first order header with REST. I am now attempting to create order lines. The “test” header I am using as a reference is “OrderNum”: “1553”.

I am getting this error:
BadRequest REST API Exception The Sales Order Number must either be less than 1000 or enter zero to allow the system to assign the number. Ice.Common.BusinessObjectException The Sales Order Number must either be less than 1000 or enter zero to allow the system to assign the number. Error OrderHed

Is there a setting I am missing somewhere?

curl_setopt_array($ch, array(


“CustNum”: 3,
“LineDesc”: “Full Adjustable Bed Frame Controller Retainer Bar”,
“OrderNum”: "’ . $OrdNum . ‘",
“OrderLine”: 3,
“SellingQuantity”: “1”,
“PartNum”: “KYV100FBA”}’,

"Authorization: Basic " . $auth,

“Accept: application/atom+xml”,
“Cache-Control: no-cache”,
“Content-Type: application/json”,
‘CallSettings: {“Company”:“25558B”,}’,
“Top: 20000”,

If you hard code in the ordernum, does it do the same thing?

@Aaron_Moreng I can confirm that it does do the same thing.

It’s often best to trace what the system does. You can trace a screen, DMT or make an update able BAQ.
I don’t believe any of them will use OrderDtl BO.

I think you hit the limit of rows returned by rest call. If you are not cloud customer, then you can remove it completely in web.config.
By default, Rest is set to only return first 100 records of the table. But with query like yours where you are retrieving rows from child table, that limit is first applied for the parent table and only child records of first 100 parent rows are retrieved.

For test try to add $top=someHugeNumber to your query.



Check your company config, I think you might find your starting SO number is 1000.

@Olga @hkeric.wci
I have top within my CURLOPT_HTTPHEADER => array(. Is this syntax incorrect? I will test out top within the “call settings” and post fields see if it has an effect.

@Hally I believe you are correct about this. I am testing this call on order number 1553 though. Does the starting SO number compromise this?

@Olga I try to call top within the postfields but recieved an invalid request error. My code for that test:

“CustNum”: 3,
“OrderNum”: “1553”,
“OrderLine”: 3,
“SellingQuantity”: “1”,
“PartNum”: “KYV100FBA”}’,

I also attempted to put the top within the call settings option in my CURLOPT_HTTPHEADER => array( but there was no change - The output still gave the error " The Sales Order Number must either be less than 1000 or enter zero to allow the system to assign the number"

Come to think of it - the error is giving me the option to let the system assign an SO number. I’m not convinced I have the right swagger URL. I am attempting to add lines to the sales order headers I recently created. is /v1/Erp.BO.SalesOrderSvc/OrderDtls the place to do it?

I might be missunderstanding you here, by if your starting SO number is less than the SO number you are entering you would get the error, if it is greater then you would get no error. That’s the behaviour I have seen using the DMT at least .

@Hally I am not totally sure - this is the first time I am making this call so its all new! It is very possible that I am adding top in to the post incorrectly - but I have tried top at 5,999,1000,1001, 5000, 20000 in the postfields, header array, and header>call settings array.

The fact that regardless of what number I put into top there is no change in the response tells me I am likely calling it wrong.

According to the first error, if you have a Starting Sales Order Number of 1000, then you can only specify Order numbers from 1 to 999. Otherwise, Epicor will expect you to give it a “0” for new Sales Orders and Epicor will create the number for you.

@Jason_Woods I already have the Sales Order from a previous REST call I did to v1/Erp.BO.SalesOrderSvc/SalesOrders. I am attempting to add line items to that order. Do you think I am making the wrong call to v1/Erp.BO.SalesOrderSvc/OrderDtls?

Yes. That’s why I offered to have you perform this in Epicor and trace the process. Your simplest methods will be for DMT or an update able BAQ.

1 Like

I meant $top for GET call, but now I think that it is not your case, Are you adding a new line to the existing order?

Thank you Jason, I will attempt to perform it in Epicor and Trace the process in just a few minutes.

Yes it is a POST to add new lines to an order I am successfully creating with another REST call.

The Portal to download the DMT software for our Pilot server is down for us at the moment. I will update as soon as I can.

Sorry for the late response, (just got out of bed). As @Jason_Woods mentioned Test adding a SO in the Epicor UO first, this will confirm things like the data you are passing in is valid. You can set the starting DO number in the Company Configuration. I’ll post a screenshot when I get into work.

Company Config

It took a couple of days to get DMT working for myself on Pilot - I apologize for the delay.

I was able to trace this DMT to the “Sales Order Detail” table:

The result was a successful import of the data. The tracelog is… massive. As I imagine yall don’t want 19,000 lines of trace logs I will post the starting lines for the 4 packets:

So I followed up looking for the “SalesOrderImpl” service on the swagger page. Now I am pretty certain in my past hunt through swagger I saw this line… but now its nowhere to be found.

The BO is simply SalesOrder (without the “Impl”).