Is there a way to get test-data from ESI?

I want get test-data from the ESI from my localhost. So I can’t actually use the access points that need an acces_token.

Is there a way to get test-data from ESI?


What do you mean test-data? Like data from the test server? To do that you would just use a query param like datasource=singularity.

To get auth’d data you should go thru the OAuth flow to get yourself an access_token and refresh_token to use for the auth’d endpoints.

I think ESI also checks for CORS. So it would likely block a request from my localhost. It will probably fail to validate the domain. Because the request would come from a domain not associated with the access_token (e.g. localhost) .

CORS is only an issue when doing a client side request, like in JavaScript. Using Curl or postman it would work fine. Also you would set your callback url in your dev app the your localhost/callback url.

My requests are client-side. ( I’m using angular6 )

EDIT: My mistake, ESI allows requests from client side as it has it open:

Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type,Authorization,If-None-Match,X-User-Agent
Access-Control-Allow-Methods: GET,HEAD,OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Type,Warning,ETag,X-Pages,X-ESI-Error-Limit-Remain,X-ESI-Error

So you would be fine making a request from Angular.

I’m getting a 404 once I try to trade in my auth_token (in angular 6).

const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type':  'application/json',
    'Authorization': 'Basic secretCode',
    'Host': ''
const json = {
  'code': authorization_code
const url = ''; '', json, httpOptions )

What’s the exact error? If possible, dump the request object built by '', json, httpOptions ) .subscribe(); as well. Since you’re using the json method, you need to stringify the authorization code in the content as well (I think, worth a try).

I figured it out. You can’t use the server-side approach from localhost: But you can use the client side approach ( which I can also use to get sample data ):

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.