Code Monkey home page Code Monkey logo

Comments (2)

thedamian avatar thedamian commented on September 28, 2024

How To Contribute - Summary

Here's the "how to" guide to adding the endpoints YOU want (because those are the best
https://github.com/jermbo/SampleAPIs/blob/main/CONTRIBUTING.md#example-of-adding-a-new-endpoint

Example of adding a new Endpoint

Our project is all about great data to play with! And I know of no one better than YOU (yes YOU) that knows what data YOU WOULD like to play with.

In this section we'll learn how to add a new dataset (or "endpoint" as we'll call them)

Each endpoint needs three files. Here's a example of a new PR adding just a new endpoint

Adding an Endpoint

Here are the official steps to add an endpoint

  1. Create a endpointName.json file
    1. eg. baseball.json for sampleapis.com/baseball/api
    2. The first level keys in the object becoming a "collection" of data. For example homeruns or stolen-bases.
    3. These will translate to .com/baseball/api/homeruns/ or .com/baseball/api/stolen-bases`
  2. Create a backup endpointName.json.backup file.
    1. This will be used as the basis for when the system resets.
  3. Update the src/apiList.js export array.
    1. This will include your new endpoint in the list on the home page.

Updating the apiList.js

There is a specific format necessary to populate the home page list. Take a look at the example below and update to match your new information.

// example from the RickAndMorty endpoint
{
  id: 22,    //use a new ID
  title: "Rick And Morty",   //Title on top of page
  longDesc: "This is t...",  //Description on the endpoint's page
  desc: "AP",  // description for front page
  link: "rickandmorty",  // endpoint url
  graphLink: "rickandmorty/graphql", // graphql endpoint
  endPoints: ["characters","episodes","locations"],   // All collections (or properties) in the endpoint from the endpointName.json file
}

from sampleapis.

Darkskittlz avatar Darkskittlz commented on September 28, 2024

Hey @jermbo I was wondering if you could forward me that article you were going off of in todays zoom about web scraping the data of a wiki page with chrome dev tools? It all happened so fast I couldn't screenshot the commands. I definitely want to add my own endpoint and will be working on this tomorrow.

All the best,
Jeremy

from sampleapis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.