Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Jaspal Singh
Jaspal Singh
13,525 Points

Use a public API to create an employee directory front end

Hi

I want to make an employee directory with the help of javascript and third party API but i could not find out that API on the internet. can anyone help me to suggest a API name.

thanks

2 Answers

Abraham Juliot
Abraham Juliot
47,353 Points

Hi Jaspai,

The use of an API implies you will be requesting data and/or sending data to a server or 3rd party server.

You can create an employee directory without a 3rd party API by storing your directory data in a json file on your web server and using ajax (xhr request) to fetch the data. Here's an example you can run:

I recommend using a lightweight and simple templating library/ framework like moonjs or preactjs. This will make it easy to iterate over an array of objects and update the dom.

You can use this API placeholder to test your json data:

Jaspal Singh
Jaspal Singh
13,525 Points

Hi Abraham

Thanks for your great advice and i was thinking to make my own Json file so that i can access that through ajax but i want to make a project through API. So any other suggestion from you will be appreciated.

thanks