Sign inSign up free

1016. Query Parameters That Survive Any Input

easy 10 XP ~8 minHands-on lab

/home/student/bin/search.sh TERM [CATEGORY] asks the catalog API http://127.0.0.1:8099/search for products. Searching for rock & roll returns results for rock, c++ finds c and #1 hits finds everything. Start the test API with /srv/lab/bin/start-catalog: it answers with the parameters it received, as JSON.

Task

Fix search.sh so that:

  • the API receives TERM as the query parameter q, exactly as given, whatever it contains (spaces, &, =, +, %, #, ?, non-ASCII letters),
  • CATEGORY, when given, is sent the same way as the parameter cat; without it, no cat parameter is sent,
  • it prints the API's response body.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Networking and TLS in Practice. Next step: Call an API with curl Like a Pro

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.