/data-manipulation

Primary LanguageJavaScriptMIT LicenseMIT

Contributors Forks Stargazers Issues MIT License


Data manipulation REST API

Endpoints to manipulate JSON data
Explore the docs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

The idea of this project is to manipulate the data through REST endpoints.

For each operation, the endpoint receive the data to manipulate in the body and the params as query parameters.

There is no logging on purpose.

(back to top)

Built With

This small REST API relies on NodeJS and Express.

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

Install NodeJS. This has been tested with the versions 18 and 20.

Installation

  1. Clone the repo
    git clone https://github.com/yannick-beot-sp/data-manipulation.git
  2. Install NPM packages
    npm install
  3. Change git remote url to avoid accidental pushes to base project
    git remote set-url origin yannick-beot-sp/data-manipulation
    git remote -v # confirm the changes
  4. Run the server
    npm start

(back to top)

Usage

By default, any successfull operation returns a 200. Any invalid parameter would result in a 400.

Test / Healthcheck

GET /?name=<name>

Parameters

name type data type default description
Name Optional String World N/A

Response 200 (application/html)

Hello <name>!

Extract a property from an array of objects

POST /extract?property=<name>

Parameters

Name Required data type description
name Y String name of the property to used from objects inside the array

Body

Array of objects. The Array can be empty. The body can be empty

Example
[
   {
       "id": "1954bab361a145d6b828c3456f9d4592",
       "name": "PRISM ERP - Report Admin",
       "description": "Grants report administrator access to the PRISM ERP system."
   },
   {
       "id": "69a487be846f458caa6b5549a38defca",
       "name": "PRISM ERP - User Access",
       "description": "Grants user access to the PRISM ERP system"
   }
]

Response 200 (application/json)

Array of string

Add an element (string or object) to an array

POST /addRow?value=<value>

Parameters

name Required data type description
value Y JSON Object It must be a valid JSON object. To add a string, the string must be between double quotes

Body

Array of objects. The Array can be empty. The body can be empty

Example
[
   {
       "id": "1954bab361a145d6b828c3456f9d4592",
       "name": "PRISM ERP - Report Admin",
       "description": "Grants report administrator access to the PRISM ERP system."
   },
   {
       "id": "69a487be846f458caa6b5549a38defca",
       "name": "PRISM ERP - User Access",
       "description": "Grants user access to the PRISM ERP system"
   }
]

Response 200 (application/json)

Array of objects

(back to top)

Roadmap

TBD

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

Top contributors:

contrib.rocks image

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

(back to top)