+ Start a Discussion
meyerdmeyerd 

Apex Rest Service: Issue after moving to Production

The following code works in Apex Rest enabled sandbox.

However after deploying the same code to production it returns

 

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

 

@RestResource(urlMapping='/MyTask/*')
global with sharing class TaskResource {
    @HttpGet
    global static Task[] doGet(RestRequest req, RestResponse res){
        Task[] result = [Select  Id, Subject, Status, ActivityDate, Priority, Description, WhatId, What.Name
                  From Task
                   where Status <> 'Completed' and ownerid = :UserInfo.getUserId() order by activitydate];
        return result;
    }
}

 

/salesforce.com/services/apexrest/MyTask

 

 

Suggestions?

 

 

alextalext

Hi,

 

May want to check under "Enabled Apex Class Access" to make sure this is configured to allow your user to get to it.

 

Let me know if this works? I came across this issue myself, and we are going to update the docs on it.


Regards,

 

--alex

meyerdmeyerd

Thanks for the suggestion Alex.

 

All Profiles had previously been added.

 

Any other suggestions?

alextalext

Hi,

 

Here is some feedback from our team:

 

    If they're in a namespaced org they need to include the namespace in the URL after /services/apexrest. 

 

Let us know if this helps here.

 

--alex

meyerdmeyerd

Hi Alex,

 

This is not part of a package so I am unsure as to what would be the namespace and why it would be different/required in prod vs sandbox.

 

This however does work now with no changes on my side.

 

Thanks to the magic