Skip to content

Instantly share code, notes, and snippets.

@darkmanlv
Last active May 22, 2024 20:31
Show Gist options
  • Save darkmanlv/d78880377748c8a39e2d354ca20f1bb0 to your computer and use it in GitHub Desktop.
Save darkmanlv/d78880377748c8a39e2d354ca20f1bb0 to your computer and use it in GitHub Desktop.
Eshop (4.0) (malfini) api usage with curl
# grab products and filter by needed fields, save result in csv file
# malfini api docs https://api.malfini.com/api-docs/index.html
# Step 1: Authenticate and get the JWT token
TOKEN=$(curl -s -X POST "https://api.malfini.com/api/v4/api-auth/login" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-d '{"username":"username","password":"password"}' | jq -r '.access_token')
# Step 2: Use the JWT token to get the product list
curl -X GET "https://api.malfini.com/api/v4/product" \
-H "accept: application/json" \
-H "Authorization: Bearer $TOKEN" | \
jq -r '.[] | .variants[] | .nomenclatures[] | [.productSizeCode, .netWeight, .grossWeight] | @csv' > products.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment