Hi All,
I am new to the Rest API and am currently able to retrieve/add/update customers after some tinkering.
General question: I was wondering how to determine the required fields when attempting to make an API call to a service? Specifically, I am trying to create a quote using the Erp.BO.QuoteSvc service. I am testing in Swagger and cannot get a quote header generated. All the parameters show as optional so I am not sure what I am missing. The error I am getting back in Swagger is shown below. Just not sure how to tell what itâs looking for.
I havenât found a good way to know exactly which fields are required. If you are a regular Epicor user or admin, it is usually intuitive. Sometimes, like in this case, it is guess and check.
It is telling you that you need to include the Reference field. That is surprising, because itâs not required in the client. Maybe Epicor is the one requiring it, or maybe there is a BPM in place at your company that requires the users to enter a value in that field.
I struggled with quotes but finally got it working with a JSON payload that looks like this for quote head. We donât actually create quote lines in our workflow with REST. Our users wanted to be able to copy paste a blob of text and have that be the entire quote because they work mostly from email. And since we donât create orders from quotes the way Epicor intends we that doesnât bother us.
Here is an example of the JSON payload that we got working:
Sent as a POST against this REST endpoint: [[your-server-address]] /v1/Erp.BO.QuoteSvc/Quotes
As far as figuring our what is mandatory and what isnât I havenât found a good way beyond testing with POSTMAN. Yes, some things are unituitive and itâs like why do you need âmarket campaignâ like couldnât Epicor just default some of this stuff?
Anyway I think you know the process start with the Swagger payload and then start removing stuff until it breaks and try again, POSTMAN is a great tool for that in case youâre not using it. I think the prevailing idea is you want to be able to pass the payload with the fewest fields possible to get it working and POSTMAN lets you rapidly play with the JSON payload to figure out what that final JSON should look like.
Postman also has a cool feature to convert the call into a programming language if you are ever developing something external thatâs calling the Epicor REST API. Itâs a good starting point at least.
Thank you so much for all the help. I should have realized that the error response was very clear that it was missing the âReferenceâ field. I read that wrong thinking it was more of a generic response. Also wanted to make sure there was area where it listed the mandatory fields for each service call.