Viv*_*k P 6 salesforce force.com visualforce apex-code
我在Force.com上使用Apex创建了一个RESTful服务,下面是我的代码.
@RestResource(urlMapping='/helloWorld/*')
global with sharing class RestWebservice {
@HttpGet
global static String helloWorld(){
return 'HelloWorld';
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用以下网址访问我的RESTful服务:https: //ap1.salesforce.com/services/apexrest/helloWorld/
作为回应我正在考虑:
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"
}
]
Run Code Online (Sandbox Code Playgroud)
下面是我的班级快照:


我该如何解决这个问题?任何帮助表示赞赏.
当您在末尾添加 *(星号)时,您需要编写一个 Id 或其他内容来代替它,如本文档中所述。我想你想要完成的事情更像是这样
@RestResource(urlMapping='/helloWorld')
Run Code Online (Sandbox Code Playgroud)
然后拨打这个电话
curl -H "Authorization: Bearer sessionId" "https://instance.salesforce.com/services/apexrest/helloWorld"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1783 次 |
| 最近记录: |