Curl command, no matches found

Hi everyone, I am new to apigee and to learn I was following the tutorial on how to build and deploy your first API proxy. https://cloud.google.com/apigee/docs/api-platform/local-development/vscode/get-started

Currently I am stuck on step 4: “Test your API” where I need to run a curl command on my helloworld proxy and get back a “Hello, Guest!” response. The helloworld proxy is an API key based authentication proxy and I have closely followed all the steps listed out in the guide, but when try and run the curl operation

curl 0:8998/helloworld?**apikey=**

With the corresponding consumer key in the Active developer apps json file of my current running emulator, the terminal states that there are no matches found. Any ideas on how I can resolve this? thank you.

1 Like

I believe that there’s a typo in your command. Please try:

curl “http://0.0.0.0:8998/helloworld?apikey=YOUR_API_KEY

3 Likes

That worked, thank you so much!

Could you please explain why the curl command that I was trying did not work. I was following what was listed on the documentation guide.

1 Like

There’s a note right at the beginning of this doc: https://cloud.google.com/apigee/docs/api-platform/local-development/vscode/tutorial-test that if you use “0” and get an error, you should replace it with “localhost” (0.0.0.0 will accept connections on all interfaces, including 127.0.0.1 (loopback address, hostname of which is “localhost”, so 0.0.0.0 works as well). Hope that it helps

2 Likes

a tale of two errors. I use zsh as my shell. Here’s what I see:

$ curl 0:8998/helloworld?apikey=445
zsh: no matches found: 0:8998/helloworld?apikey=445

$ curl 0:8998/helloworld\?apikey=445
curl: (7) Failed to connect to 0.0.0.0 port 8998 after 0 ms: Couldn't connect to server

The first error is from zsh. It is trying to interpret ? as a wildcard character to match a filename. This is probably not what you want. So the error is expected and is telling you that the sequence that includes a question mark is not matching any files.

I can tell zsh to just treat the? as a question mark, which is what I want, by prefixing it with a backslash. The 2nd command does that. I get a different error this time, from curl. It’s saying it cannot connect to the server running at address 0 (0.0.0.0), at port 8998. This is expected; I have no local server running there. (You may have a server running there on your machine, as part of the tutorial work you’ve done).

3 Likes