title: Cannot reach Endpoint method with cURL
body: <p>I have created a Cloud Endpoint through Android Studio as part of an Android project.</p>
  
  <p>I am not intending to use this part of the Cloud Endpoint with Android.</p>
  
  <p>I need to access this Cloud Endpoint with cURL. I am getting the error:</p>
  
  <blockquote>
    <p>404 - Not Found</p>
  </blockquote>
  
  <p>The Endpoint is online, as I can see the index.html at the usual URL:</p>
  
  <p><a href="http://appid.appspot.com/" rel="nofollow noreferrer">http://appid.appspot.com/</a></p>
  
  <blockquote>
    <p>Hello, Endpoints!</p>
    
    <p>Enter your name and press the button below to call your Google Cloud Endpoints API.</p>
  </blockquote>
  
  <p>In order to find the URL I used the discovery URL for apis:</p>
  
  <p><a href="https://appid.appspot.com/_ah/api/discovery/v1/apis" rel="nofollow noreferrer">https://appid.appspot.com/_ah/api/discovery/v1/apis</a></p>
  
  <p>That delivered this JSON (sensitive data obfuscated):</p>
  
  <pre><code>{
   "kind": "discovery#directoryList",
   "discoveryVersion": "v1",
   "items": [
    {
     "kind": "discovery#directoryItem",
     "id": "discovery:v1",
     "name": "discovery",
     "version": "v1",
     "title": "APIs Discovery Service",
     "description": "Provides information about other Google APIs, such as what APIs are available, the resource, and method details for each API.",
     "discoveryRestUrl": "https://appid.appspot.com/_ah/api/discovery/v1/apis/discovery/v1/rest",
     "discoveryLink": "./apis/discovery/v1/rest",
     "icons": {
      "x16": "http://www.google.com/images/icons/feature/filing_cabinet_search-g16.png",
      "x32": "http://www.google.com/images/icons/feature/filing_cabinet_search-g32.png"
     },
     "documentationLink": "https://developers.google.com/discovery/",
     "preferred": true
    },
    {
     "kind": "discovery#directoryItem",
     "id": "myApi:v1",
     "name": "myApi",
     "version": "v1",
     "description": "This is an API",
     "discoveryRestUrl": "https://appid.appspot.com/_ah/api/discovery/v1/apis/myApi/v1/rest",
     "discoveryLink": "./apis/myApi/v1/rest",
     "icons": {
      "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
      "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"
     },
     "preferred": true
    }
   ]
  }
  </code></pre>
  
  <hr>
  
  <p>I took the <code>discoveryRestUrl</code> for the api <code>myApi</code>.</p>
  
  <p><a href="https://appid.appspot.com/_ah/api/discovery/v1/apis/myApi/v1/rest" rel="nofollow noreferrer">https://appid.appspot.com/_ah/api/discovery/v1/apis/myApi/v1/rest</a></p>
  
  <pre><code>{
   "kind": "discovery#restDescription",
   "etag": "\"ODRTh3xaRR64wpeXJSlF33HMN-0/uPLUFYnKhGLgMnhurkbMaKcMDpA\"",
   "discoveryVersion": "v1",
   "id": "myApi:v1",
   "name": "myApi",
   "version": "v1",
   "description": "This is an API",
   "ownerDomain": "backend.appid.companydomain.com",
   "ownerName": "backend.appid.companydomain.com",
   "icons": {
    "x16": "https://www.gstatic.com/images/branding/product/1x/googleg_16dp.png",
    "x32": "https://www.gstatic.com/images/branding/product/1x/googleg_32dp.png"
   },
   "protocol": "rest",
   "baseUrl": "https://appid.appspot.com/_ah/api/myApi/v1/sayHi/",
   "basePath": "/_ah/api/myApi/v1/sayHi/",
   "rootUrl": "https://appid.appspot.com/_ah/api/",
   "servicePath": "myApi/v1/sayHi/",
   "batchPath": "batch",
   "parameters": {
    "alt": {
     "type": "string",
     "description": "Data format for the response.",
     "default": "json",
     "enum": [
      "json"
     ],
     "enumDescriptions": [
      "Responses with Content-Type of application/json"
     ],
     "location": "query"
    },
    "fields": {
     "type": "string",
     "description": "Selector specifying which fields to include in a partial response.",
     "location": "query"
    },
    "key": {
     "type": "string",
     "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
     "location": "query"
    },
    "oauth_token": {
     "type": "string",
     "description": "OAuth 2.0 token for the current user.",
     "location": "query"
    },
    "prettyPrint": {
     "type": "boolean",
     "description": "Returns response with indentations and line breaks.",
     "default": "true",
     "location": "query"
    },
    "quotaUser": {
     "type": "string",
     "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
     "location": "query"
    },
    "userIp": {
     "type": "string",
     "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
     "location": "query"
    }
   },
   "auth": {
    "oauth2": {
     "scopes": {
      "https://www.googleapis.com/auth/userinfo.email": {
       "description": "View your email address"
      }
     }
    }
   },
   "schemas": {
    "MyBean": {
     "id": "MyBean",
     "type": "object",
     "properties": {
      "data": {
       "type": "string"
      }
     }
    }
   },
   "methods": {
    "sayHi": {
     "id": "myApi.sayHi",
     "path": "{name}",
     "httpMethod": "POST",
     "parameters": {
      "name": {
       "type": "string",
       "required": true,
       "location": "path"
      }
     },
     "parameterOrder": [
      "name"
     ],
     "response": {
      "$ref": "MyBean"
     },
     "scopes": [
      "https://www.googleapis.com/auth/userinfo.email"
     ]
    }
   }
  }
  </code></pre>
  
  <p>I took the URL from here: <code>"baseUrl": "https://appid.appspot.com/_ah/api/myApi/v1/sayHi/"</code>.</p>
  
  <p>My curl command:</p>
  
  <pre><code>curl --header "Content-Type: application/json" -X POST -d '{"name": "Testing"}' http://appid.appspot.com/_ah/api/myApi/v1/sayHi
  </code></pre>
  
  <p>What URL should I use? Is it more likely that something isn't set up correctly?</p>
  
  <h2>@Jeff O'Neill - Update 1</h2>
  
  <p>Testing using the following URL:</p>
  
  <p><a href="http://appid.appspot.com/myApi/v1/sayHi" rel="nofollow noreferrer">http://appid.appspot.com/myApi/v1/sayHi</a></p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html;charset=utf-8"&gt;
  &lt;title&gt;404 Not Found&lt;/title&gt;
  &lt;/head&gt;
  &lt;body text=#000000 bgcolor=#ffffff&gt;
  &lt;h1&gt;Error: Not Found&lt;/h1&gt;
  &lt;h2&gt;The requested URL &lt;code&gt;/myApi/v1/sayHi&lt;/code&gt; was not found on this server.&lt;/h2&gt;
  &lt;h2&gt;&lt;/h2&gt;
  &lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <h2>Update 2</h2>
  
  <p>I experimented with this Endpoint:</p>
  
  <pre><code>/**
   * A simple endpoint method that takes a name and says Hi back
   */
  @ApiMethod(name = "sayHi2", path = "test")
  public MyBean sayHi2() {
      MyBean response = new MyBean();
      response.setData("This is a message");
  
      return response;
  }
  </code></pre>
  
  <p>I can call this with:</p>
  
  <pre><code>curl --header "Content-Type: application/json" -X POST https://appid.appspot.com/_ah/api/myApi/v1/test
  </code></pre>
  
  <p>I still cannot explain why the original Endpoint cannot be reached, but if adding a path annotation fixes it then I am happy.</p>