function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

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"
} ]


global with sharing class TaskResource {
    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;











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.





Thanks for the suggestion Alex.


All Profiles had previously been added.


Any other suggestions?




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.




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