Skip to content

imthatalex/js-axios-api-account-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 

Repository files navigation

API Account Manager

This program was originally intended to fetch accounts from a specific API using an ID and perform basic CRUD operations such as create, read, update and delete these accounts. The original API is no longer available, but the code can still be used with any API that uses an ID for retrieving data.

Prerequisites

  • Understanding of API calls and authentication methods
  • Access to an API endpoint that uses an ID to retrieve data

Using the Program

  1. Clone or Download the Repo.
  2. Update the getOptionValuesUrl variable in the code with the endpoint of the API you are using.
    let getOptionValuesUrl = 'https://services.metricsamsi.com/v1.0/dealers/Options/' + idSelected + '?apiKey=81c14de2-6891-461b-9ea6-3ed218675b8f';

        axios.get(getOptionValuesUrl, { validateStatus: () => true })
            .then(response => examineResponse(response))
            .then(data => displayOptionValues(data))
    }
  1. Update the headers variable with the necessary authentication information for the API.
    function examineResponse(response) {
        if (response.status == 200) {
            console.log('Initial Values Values Received');
            idSelectedInput.value = '';
            return response.data;
        }
        else if (response.status == 403) {
            console.log('Initial Values Forbidden')
            alert('Google ID is Locked');
        }
        else if (response.status == 500) {
            console.log('Initial Values Server Error')
            alert('500 Server Error');
        }
    }
  1. Open http://localhost:3000 in your browser to use the GUI & interact with the API.

Features

  • Uses JavaScript and the axios library for making API calls
  • Uses an ID to retrieve data from the API
  • Includes functions for performing basic CRUD operations
  • Can be easily adapted to work with any API that uses an ID for retrieving data

Built With

  • JavaScript
  • Axios - JavaScript library for making HTTP requests

Acknowledgments

Axios documentation for guidance on making HTTP requests, please note, the code provided in this file is just an example and it may not work if you run it, as it needs to be adapted to the specific API endpoint you want to use with it.

About

software application that interacts with a database through an API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published