REST command line

I love my team. Start brainstorming something internally on a weekend and get another geek scratching their head and curious, start my morning and see the answer below waiting for me…

Thinking outside the box examples - No warranty - Hack - Don’t yell at me or the company if it doesn’t work

For background, review the REST Overview (REST Overview Novel - Experts' Corner - Epicor User Help Forum)

cURL is a a utility for executing a URL via a command line and transferring data. It makes command line parameters for headers, etc. Spend some time at (https://curl.haxx.se/)

One example of the power of REST with BAQ and a CLI is below.

curl -X GET --header “Accept: application/atom+xml” “https://rm1016-pc0dd37y.americas.epicor.net/Erp10/api/v1/BaqSvc/zSalesOrderStatus/” -u manager:Epicor123

Let’s break this down:

  • curl is the open source utility mentioned.
  • We are doing a GET so it’s just a file download
  • We are asking for xml format “Accept: application/atom+xml”
  • The URL is the address from the help page:

    *The username and password (oops, my secret identity is out!)

When executed from a command line you get the xml data returned

Now you can start directing responses to a file. How about trying old fashioned redirect:
curl -X GET --header “Accept: application/atom+xml” “https://rm1016-pc0dd37y.americas.epicor.net/Erp10/api/v1/BaqSvc/zSalesOrderStatus/” -u manager:Epicor123 >> output.txt

and you have a dump from the BAQ:

If you want to set it on a schedule to execute?
Spend some time learning the standard tools in the operating system - Windows Task Scheduler

5 Likes

Looks like a great place for an OAuth token instead of a username password :wink:

Have you looked at the current token implementation?

It’s not quite Oauth as it was written before Oauth was ratified. The Legacy Activant folks used it and we added it to ICE to share authentication across the product lines.

The obvious next step is to span external products with open standards.

No commitments provided, forward looking statement, I don’t control product roadmap, don’t yell at us or me if it does not happen, etc etc I need to add this to some signature in here :wink:

sorry, not quite sure what you mean

Instead of hard coding usernames and passwords in conversation, user tokens and API tokens are commonly used to identify a client calling a server. OAuth is one style of authenticating and identifying users.

Somewhat readable overview.
(OAuth - Wikipedia)

1 Like