Javalin IO (Java): Path parameter 'id' with value 'list' is not a valid Long

689 views Asked by At

Coming across a problem in Javalin where the Console output in my IntelliJ Idea IDE, is outputting a 400 HTTP error code, where it has a problem trying to have a: List<Long> id parameter, which is being called as just a: Long id in other classes when trying to create new instances for its class Workout.java, from a Data Access Object called WorkoutDAO.java.

Currently the code compiles well, its just an error that occurs when I traverse to the page where the 400 error code occurs.

Javalin in the console outputs this:

[qtp1226622409-20] INFO io.javalin.Javalin - JAVALIN REQUEST DEBUG LOG:
Request: GET [/workouts/list]
    Matching endpoint-handlers: [GET=/workouts/:id]
    Headers: {Cookie=JSESSIONID=node01ls164g1wqing5fm7jinkalm61.node0, Accept=text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9, Connection=keep-alive, User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.20 Safari/537.36, Referer=http://localhost:7000/, Sec-Fetch-Site=same-origin, Sec-Fetch-Dest=document, Host=localhost:7000, Accept-Encoding=gzip, deflate, br, Sec-Fetch-Mode=navigate, sec-ch-ua="Google Chrome";v="87", "\"Not;A\\Brand";v="99", "Chromium";v="87", sec-ch-ua-mobile=?0, Upgrade-Insecure-Requests=1, Sec-Fetch-User=?1, Accept-Language=en-US,en;q=0.9}
    Cookies: {JSESSIONID=node01ls164g1wqing5fm7jinkalm61.node0}
    Body: 
    QueryString: null
    QueryParams: {}
    FormParams: {}
Response: [400], execution took 0.44 ms
    Headers: {Server=Javalin, Date=Thu, 15 Oct 2020 08:39:45 GMT, Content-Type=text/plain}
    Body is 57 bytes (starts on next line):
    Path parameter 'id' with value 'list' is not a valid Long

I anyone knows how to help me out with this. That would be great.

1

There are 1 answers

0
Abhinav Agarwal On

To get all workouts, You should call GET /workouts. Assuming it is implemented.

To get a single workout object, Id has to be passed after /workouts eg: GET /workouts/1