Parser reads CSV, filtering, identifies fields to be changed, and sends request to the REST API.
365
The csv2api parser reads the CSV file with the raw data, filters the records, identifies fields to be changed, and sends a request to update the data to the specified endpoint of your REST API.
All actions take place according to the settings in the configuration file.
Features:
Prepare your config and input data files:
config.yml:
columns_order section is a
primary key (PK) for your process.api section.filter_columns section.update_fields section.data.csv:
π‘ Note: See the repository's Wikiβ page to understand the structure of the config and input data files.
And now, run csv2api with options:
docker run --rm -it -v ${PWD}:${PWD} -w ${PWD} koddr/csv2api:latest \
-c /path/to/config.yml \
-d /path/to/data.csv \
-e CONFIG
Done! π Your transactions have been performed:
Hello and welcome to csv2api! π
β According to the settings in './config.yml', 5 transactions were filtered out of 10 to start the process.
β Only 3 transactions got into the final set of actions to be taken... Please wait!
β Field 'tags' with values '[paid]' in the transaction '2' has been successfully updated (HTTP 200)
β Field 'tags' with values '[paid]' in the transaction '8' has been successfully updated (HTTP 200)
β Field 'tags' with values '[paid]' in the transaction '10' has been successfully updated (HTTP 200)
β Saving filtered transactions to CSV file './filtered-1686993960.csv' in the current dir... OK!
All done! π Time elapsed: 0.11s
| Option | Description | Is required? | Default value |
|---|---|---|---|
-i | set to generate initial config (config.yaml) and example data (data.csv) files | no | false |
-c | set path to your config file | yes | "" |
-d | set path to your CSV file with input data | yes | "" |
-e | set prefix used in your environment variables | no | CONFIG |
In my work, I often have to work with large amounts of raw data in CSV format.
Usually it goes like this:
And I'm not talking about the fact that the final REST API (where to send a request with the processed data) do not always have the same parameters for the request body.
To ease this whole process, I created this parser that takes absolutely any data file as input, does the conversions and filtering, and is set up in one single configuration file.
Just prepare the data, set the configuration to your liking, run csv2api
and wait a bit! Yes, it's that simple.
csv2apiβ is free and open-source software licensed
under the Apache 2.0 Licenseβ , created and supported with π©΅
for people and robots by Vic ShΓ³stakβ .
Content type
Image
Digest
sha256:680350e50β¦
Size
2 MB
Last updated
over 3 years ago
docker pull koddr/csv2api