6

I have create a RESTful service on Force.com using Apex below is my code.

@RestResource(urlMapping='/helloWorld/*')
global with sharing class RestWebservice {

  @HttpGet
  global static String helloWorld(){
    return 'HelloWorld';
  }

}

I am trying to access my RESTful services using below url: https://ap1.salesforce.com/services/apexrest/helloWorld/

In response i am geting:

HTTP/1.1 404 Not Found
Date:Thu, 18 Jul 2013 07:35:44 GMT
Content-Length:96
Content-Type:application/json;charset=UTF-8

[
  {
    "message": "Could not find a match for URL /helloWorld/",
    "errorCode": "NOT_FOUND"
  }
]

Below is my class snapshot: enter image description here

enter image description here

how can i resolve this issue ? Any help is appreciated.

Vivek P
  • 3,050
  • 6
  • 27
  • 31

1 Answers1

3

When you putting an * (asterisk) in the end you need to write an Id or something instead of it like is described in this document . What you are trying to accomplish i guess is more like this

 @RestResource(urlMapping='/helloWorld')

And then make this call

curl -H "Authorization: Bearer sessionId"  "https://instance.salesforce.com/services/apexrest/helloWorld"
Moti Korets
  • 3,738
  • 2
  • 26
  • 35
  • I tried this iam get same error as "Could not find a match for URL /helloWorld" – Vivek P Jul 18 '13 at 11:19
  • Pay attention if you put a final slash after helloWorld/ . Double check spelling pay attention to characters case. Make sure the class compiled and exists in Salesforce (try access it from web interface just to make sure). Finally it should work seems you doing everything right. If still no go, please repost your new code. – Moti Korets Jul 18 '13 at 11:36