You need to sign in to do that
Don't have an account?
404 Apex REST
Hello,
I'm working with calling APEX REST classes outside of salesforce. 2 month ago I got APEX REST class with long logic which worked perfectly, I called that logic by python script with authorizarion (oAuth 2.0). And now it doesn't work, even when I'm trying to call simple APEX REST like:
@RestResource(urlMapping = '/test_yury/*')
global with sharing class SAP_BOMclass_Yury_test {
@HttpGet
global static string BOMtest(RestRequest req, RestResponse res)
{
return 'hello there';
}
@HttpPost
global static string BOMtest1(RestRequest req, RestResponse res)
{
return 'hello there';
}
}
I'm calling it by url https://<instance>.salesforce.com/services/apexrest/test_yury with headers 'Authorization' : 'OAuth '+<access_token>(https://<instance>.salesforce.com/services/apexrest/test_yury ws implemented in Remote Access tab).
Also tryed HTTP POST/GET at https://apigee.com , which I saw salesforce used it in some webinar..
But still I'm getting 404 error :
HTTP/1.1 404 Not Found
Date: Mon, 09 Jan 2012 09:44:22 GMT Content-Length: 98 Content-Type: application/json; charset=UTF-8 Connection: close Server: [ { "message": "Could not find a match for URL /test_yury","errorCode": "NOT_FOUND} ]
Any ideas why this error started poping up?
Thanks
It appears that your org has a namespace, but you're not including the namespace in the requests.
All Answers
I don't beleive that /{foo}/* will match a request to /{foo} which appears to be what you're trying to do, either change the request URL or change the urlMatching parameter.
Here is some screen shots that can clarify my problem...
Apex REST class:
http://img267.imageshack.us/img267/2517/apexclass.png
Remote access tab:
http://img192.imageshack.us/img192/4560/remoteaccess.png
Access token headers(apigee program):
http://img14.imageshack.us/img14/8546/71767084.png
Apigee HTTP POST and 404 error:
http://img846.imageshack.us/img846/6685/apigeepost.png
What am I doing wrong?:/
Regards,
Yury.
It appears that your org has a namespace, but you're not including the namespace in the requests.
Simon,
Thank you very much!!
It's working perfectly now.
Regards,
Yury.
Hi,
I have same issue but can't resolve.
Here is my class
@RestResource(urlMapping='/restdemo/*')
global with sharing class RESTClassController {
@HttpGet
global static List<Contact> getContact(RestRequest req, RestResponse res) {
//String cName = req.params.get('cname');
return Database.query('SELECT Id, Name, Email FROM Contact ');
}
}
And I am using apigee, i am calling Webservice as follow:
https://ap1.salesforce.com/services/apexrest/restdemo
or
https://ap1.salesforce.com/services/apexrest/restdemo?name=s
This is my response:
HTTP/1.1 404 Not Found
Date: Fri, 10 Feb 2012 15:30:42 GMT Content-Length: 2562 Content-Type: text/html; charset=UTF-8 Connection: close Server: ---------------
Can any one tell me what is the issue. and i don't understand about namespace.
Can anyone help me?
Thanks
https://ap1.salesforce.com/services/apexrest/restdemo?name=s
try to add ur org.
https://ap1.salesforce.com/services/apexrest/<Name_of_org>/restdemo?name=s
Thanks,
I tried with this:
https://ap1.salesforce.com/services/apexrest/iBirdsServices/restdemo?name=s
or
https://ap1.salesforce.com/services/apexrest/00D90000000Hcvq/restdemo?name=s
But does not work.
Labels for Org Name:
Organization Name = iBirdsServices
Salesforce.com Organization ID = 00D90000000Hcvq
Am i missing somthing?
Thanks
I'm not sure, but it might help.
try to delete "RestRequest req, RestResponse res", cuz I have heard that some instances are spring 12' already, and there is changes, that you dont need RestRequest and RestResponse in Apex REST classes.
@RestResource(urlMapping='/restdemo/*')
global with sharing class RESTClassController {
@HttpGet
global static List<Contact> getContact() {
//String cName = req.params.get('cname');
return Database.query('SELECT Id, Name, Email FROM Contact ');
}
}
Thanks,
Yury.
Hi,
Still not working.... :(
@RestResource(urlMapping='/restdemo/*')
global with sharing class RESTClassController {
@HttpGet
global static List<Contact> getContact() {
//String cName = req.params.get('cname');
return Database.query('SELECT Id, Name, Email FROM Contact ');
}
}
Thanks
This is response:
HTTP/1.1 404 Not Found
Date: Sat, 11 Feb 2012 05:58:05 GMT Content-Length: 2562 Content-Type: text/html; charset=UTF-8 Connection: close Server:
You have attempted to reach a URL that no longer exists on salesforce.com.
Hi,
Find the issue. It just because of new and old apigee console. I was watching demo that is based on old console and there we need to give complete url that begins from https:///...
But in new console we just need to give url from services.
e.g.
services/apexrest/restdemo
Thanks for you help :)
Error:
Raw Response
HTTP/1.1 404 Not Found
Below is my rest class.
/* selflearning is a namespace of my org*/
@RestResource(urlMapping='/selflearning__/accessPobject/*')
global class restServicePObj
{
@HttpGet
global Static List<selflearning__Pobject__c> getPobjectDetails()
{
return[select id,Name from selflearning__Pobject__c];
}
}
Please help me/guide me how I can do this in a right way.
Thanks,
Ankit