Change /rest to /v2.
According to the official LinkedIn changelog:
Starting with version 202307, API decoration will no longer be supported for any API. We’ve created this video to assist you with this change.
Unfortunately, as of now, LinkedIn has not provided an alternative method to achieve this without using decorations. I'm still using v2 to all of my calls.