Api Error Resource Not Found
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss
Api Error Resource Not Found Installous 5
the workings and policies of this site About Us Learn more about installous says api unavailable Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow api error resource not found ipad Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each
Api Error Resource Not Found Ipad 2
other. Join them; it only takes a minute: Sign up Is it correct to return 404 when a REST resource is not found? up vote 8 down vote favorite 2 Let's say I have a simple Jersey REST resource as follows: @Path("/foos") public class MyRestlet extends BaseRestlet { @GET @Path("/{fooId}") @Produces(MediaType.APPLICATION_XML) public Response getFoo(@PathParam("fooId") final String fooId) throws IOException,
How To Fix Api Error Resource Not Found
ParseException { final Foo foo = fooService.getFoo(fooId); if (foo != null) { return Response.status(Response.Status.OK).entity(foo).build(); } else { return Response.status(Response.Status.NOT_FOUND).build(); } } } Based on the code above, is it correct to return a NOT_FOUND status (404), or should I be returning 204, or some other more appropriate code? Many thanks in advance! java rest jax-rs http-status-codes jersey-2.0 share|improve this question edited Nov 10 '14 at 14:47 peeskillet 77.9k1283154 asked Nov 10 '14 at 14:05 carlspring 12.8k1048101 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote accepted A 404 response in this case is pretty typical and easy for API users to consume. One problem is that it is difficult for a client to tell if they got a 404 due to the particular entity not being found, or due to a structural problem in the URI. In your example, /foos/5 might return 404 because the foo with id=5 does not exist. However, /food/1 would return 404 even if foo with id=1 exists (because "foos" is misspelled). In othe
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn api error resource not found installous 4 more about Stack Overflow the company Business Learn more about hiring developers or posting
Api Error Resource Not Found Installous Search
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community rest api 404 not found Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What is the proper REST response code for a valid http://stackoverflow.com/questions/26845631/is-it-correct-to-return-404-when-a-rest-resource-is-not-found request but an empty data? up vote 52 down vote favorite 18 For example you run a GET request for users/9 but there is no user with id #9. Which is the best response code? 200 OK 202 Accepted 204 No Content 400 Bad Request 404 Not Found api http rest share|improve this question asked Jul 31 '12 at 18:45 IMB 2,35272965 2 Hint: Did you find http://stackoverflow.com/questions/11746894/what-is-the-proper-rest-response-code-for-a-valid-request-but-an-empty-data User 9? –Crisfole Jul 31 '12 at 18:47 6 Hint 2: So the user 9 was not found? –Tomasz Nurkiewicz Jul 31 '12 at 18:49 4 @IMB who is saying 204? "No Content" indicates that the entity you're looking for exists, but has no representation. For example if blog with id 15 has no comments, and you didn't want to return an empty list for blog number 15's comments: "/blog/15/comments" would return NoContent. On the other hand if blog 15 does exists, '404 Not Found' is more appropriate. –Crisfole Jul 31 '12 at 19:50 3 @Crisfole didn't you mean ". On the other hand if blog 15 does not exists, '404 Not Found' is more appropriate" –gdoron Dec 7 '15 at 9:02 4 I most certainly did @gdoron! :) Thanks. Sadly I'm approximately three years too late to edit that and fix. –Crisfole Dec 7 '15 at 17:25 | show 4 more comments 5 Answers 5 active oldest votes up vote 58 down vote accepted TL;DR: Use 404 See This Blog. It explains it very well. Summary of the blog's comments on 204: 204 No Content is not terribly useful as a response code for a browser (although acc
for a quick overview of the site Help Center Detailed answers to any http://salesforce.stackexchange.com/questions/83958/tooling-api-giving-error-of-resource-not-found questions you might have Meta Discuss the workings and policies http://www.restapitutorial.com/httpstatuscodes.html of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Salesforce Questions Tags Users Badges Unanswered Ask Question _ Salesforce Stack Exchange is a question and answer not found site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Tooling API giving error of resource not found up api error resource vote -1 down vote favorite I am trying to do a simple code with Tooling API, where I am trying to execute anonymous one statement with tooling API. Sample request - HttpRequest req = new HttpRequest(); req.setHeader('Authorization', 'Bearer ' + SESSION_ID); req.setHeader('Content-Type', 'application/json'); String code = 'System.debug(\'Test\')'; String contentValue = EncodingUtil.urlEncode(code, 'UTF-8'); req.setEndpoint('https://ap1.salesforce.com/services/data/v28.0/tooling/executeAnonymous/anonymousBody=' + contentValue + '/'); req.setMethod('GET'); The error that I am getting is [{"errorCode":"NOT_FOUND","message":"The requested resource does not exist"}] Any idea why I am getting this. The /sobjects tooling request work wothout issue while /sobjects/contact/describe gives same error as above. Thanks Ray apex salesforce-crm rest-api tooling-api share|improve this question asked Jul 19 '15 at 13:19 Kaushik Ray 798518 why negative on question? Please add comments –Kaushik Ray Jul 19 '15 at 18:29 add a comment| 1 Answer 1 active oldest votes up vote -1 down vote accepted So this got solved. There was a mis
consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did not define any 1xx status codes, servers MUST NOT send a 1xx response to an HTTP/1.0 client except under experimental conditions. A client MUST be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent. Proxies MUST forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).) Wikipedia Request received, continuing process. This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define any 1xx status codes, servers must not send a 1xx response to an HTTP/1.0 client except under experimental conditions. 100 Continue The client SHOULD continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code. Wikipedia This means that the server has received the request headers, and that the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). If the request body is large, sending it to a server when a request has already been rejected based upon inappropriate headers is inefficient. To have a server check if the request could be accepted based on the request's headers alone, a client must send Expect: 100-continue as a header in its initial request and check if a 100 Continue status code is received in response before c