Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What do you suggest to use instead of Google Poly? #3

Open
luc4leone opened this issue Dec 22, 2021 · 4 comments
Open

What do you suggest to use instead of Google Poly? #3

luc4leone opened this issue Dec 22, 2021 · 4 comments

Comments

@luc4leone
Copy link

Since Google shut down Poly https://support.google.com/poly/answer/10192635 it's impossible to follow Chapter 3 verbatim.

Ben what do you suggest? Do you have another similar API to suggest? Or maybe some other tip?

Thanks! Your book is great so far 🥇

@luc4leone
Copy link
Author

It seems Google didn't shut down the API, since putting this in the browser console works fine, returning back an object.

const url = 'https://poly.googleapis.com/v1/assets?keywords=parrot&format=OBJ&key=AIzaSyDco09I8HAL-f4LrkSIOJVqZvqLpzMVTLA';
const request = new XMLHttpRequest();
request.open( 'GET', url, true );
request.addEventListener( 'load', (event) => {
  console.log(JSON.parse( event.target.response ));
});
request.send();

But also, I got to the point in the chapter where you suggest to test:

baseuri="http://localhost:8080/assets.json"

So we can test the component by fetching data from the local server (there's a copy of assets here in this repo https://github.com/bengfarrell/webcomponentsinaction/blob/master/chapter3/assets.json).

@bengfarrell
Copy link
Owner

Yeah, I did want something like this to show off fetching data from a public place and the Poly API was perfect since it returns data and images. But I knew any API would be fairly unsafe given that they change after time, or in this case completely shut down. I think probably the responses you're getting are cached on their end, or read only because they did shut down the service from what I recall. Anyway, all this is exactly why I have that JSON file there. Glad you got things working!

@luc4leone
Copy link
Author

Thanks Ben! Really enjoying the book.

@bengfarrell
Copy link
Owner

Thanks! Glad to hear it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants