Giter Site home page Giter Site logo

eaternity-api's People

Contributors

actions-user avatar ajaggi avatar ascheuss avatar chamer81 avatar eaternity-agent avatar hfinger avatar jan-eat avatar mklarmann avatar pnwinkler avatar schinke avatar shchoi839 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eaternity-api's Issues

Error using https://co2.eaternity.ch/api/products/:id endpoint

I have problem with creating new product using the PUT https://co2.eaternity.ch/api/products/:id endpoint.
I used to be able to do it without specifying nutrient-values.
However, now when I try the following request

curl --location --request PUT 'https://co2.eaternity.ch/api/products/1144facb-331b-43f4-8749-e4f71e5ad2bd' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic XXX' \
--data-raw '{
    "id": "54a8b6fc-ceaf-4eaf-83bf-3d1b6b45a24e",
    "amount": 1.0,
    "ingredients-declaration": "Gemüsespieße",
    "names": [
        {
            "language": "de",
            "value": "Gemüsespieße"
        }
    ]
}'

I am getting following error status=400 and payload

BAD REQUEST: nutrient-values can not be empty.

I tried with the following without any success

  1. Adding "nutrient-values": {"amount":1.0}
curl --location --request PUT 'https://co2.eaternity.ch/api/products/1144facb-331b-43f4-8749-e4f71e5ad2bd' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic XXX' \
--data-raw '{
   "id": "54a8b6fc-ceaf-4eaf-83bf-3d1b6b45a24e",
   "amount": 1.0,
   "ingredients-declaration": "Gemüsespieße",
   "names": [
       {
           "language": "de",
           "value": "Gemüsespieße"
       }
   ],
   "nutrient-values": {"amount":1.0}
}'

with the same error

BAD REQUEST: nutrient-values can not be empty.
  1. I tried with array of objects as follow
curl --location --request PUT 'https://co2.eaternity.ch/api/products/1144facb-331b-43f4-8749-e4f71e5ad2bd' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Basic XXX' \
--data-raw '{
   "id": "54a8b6fc-ceaf-4eaf-83bf-3d1b6b45a24e",
   "amount": 1.0,
   "ingredients-declaration": "Gemüsespieße",
   "names": [
       {
           "language": "de",
           "value": "Gemüsespieße"
       }
   ],
   "nutrient-values": [{"amount":1.0}]
}'

and getting the following error

{
   "status": "BAD_REQUEST",
   "key": "json processing exception",
   "message": "JSON parsing error on line number 11. Check API Documentation and JSON format."
}

Any idea what is the required payload? We use to use this endpoint by only provided the name and the amount.
What is the required minimum payload.

Create a recipe example does not have kitchen-id

This is just a friendly suggestion, to make it easier to work with the documentation.

In Create a recipe (https://github.com/Eaternity/eaternity-api/blob/master/apiary.apib#L420) in the documentation, the example request does not work (when copy+pasting into postman) because:

  1. It does not have a kitchen-id
    It would be nice if this field name was specified.

  2. Invalid json
    Line 46 and 68 is not valid json (for example "gtin": 00012345678905), are lacking " ". This returns an error.

Perhaps, there is a good reason why the request looks like it does. In that case, feel free to just close this issue!

/ Philip

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.