REST Question - Get (external c#)

Hi,

I’m just starting out in REST and have had some fantastic help from @RJM.
I’m using @josecgomez excellent EpicorRESTAPI (thanks Jose!) and am struggling to understand BoPost.
A few things that I need a little help with:

When we do a “BoPost” we pass in an empty dataset - this is then filled and we can access the records directly using the table name structure e.g. [“OrderHed”] -
~~dynamic dOH = dNewOrdH.ResponseData.parameters.ds; ~~ Hope my understanding is correct.
When we use “BoGet” we get a dynamic object that has a responsedata - but I can’t access this in the same way. I am also trying to get a particular record but it’s bringing back another:

so on Sales Order a trace reveals:

I thought I would be able to access this ‘dataset’ (I appreciate it isn’t a real dataset - more a dynamic object).

Hope this makes sense to someone. Any suggestions very much appreciated.

I’m thinking I can do a get, bind the data to controls, change the data and then do a “BoPost” to update the data. Is that the way other people are going about this?

Thanks for taking the time to read my babbling post!
Mark

I’m not sure I totally follow.

To access the response on your get you have to go

ds.value[0].OrderNum 

Since it returns an array of orders value is an array and needs to be trated as such. Hopefully that helps.

You are using the oData method here so you don’t get a dataset if you want a dataset you need to swithc to custom methods. GetByID()

Thanks for the quick response Jose.
Apologies for me babbling.
First thing - I passed the order number in and thought that this would only show the one order not 100 of them:

Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("Company", "CABP");
            dic.Add("OrderNum", txtOrderNum.Text);
            CallContextHeader callContext = new CallContextHeader();

            dynamic dNewOrd = EpicorRest.BoGet("Erp.BO.SalesOrderSvc", "SalesOrders", dic, callContext);

Thanks - can now access data at the orderhed level -but what about lower down e.g. OrderDtl?

I used to use the external dll - getByID - update some data and then update this DS - Am i going about this all wrong in REST? I presumed I would BOGet - update data in the object and then PUT back ?

Thanks
Mark

So Rest has TWO ways of being called oData and “CustomMethods”

oData is a standard and you get a URL per table so if you want to get the OrderLines you need to make another call.

If you want to get a whole dataset you need to switch to Custom Methods. And you would then call GetByID like normal with a dataset.

3 Likes

Ah - Got it thank you!