run(APP::EXEC_MODE_API); API::setWrapper(); $client = new ScimApiClient(); $client->setServiceFactory(new CRegistryFactory([ 'users' => User::class, 'groups' => Group::class, 'serviceproviderconfig' => ServiceProviderConfig::class ])); $scim = new SCIM(); $response = $scim->execute($client, $request); } catch (Throwable $e) { $response = new HttpResponse(); if (!$e->getCode() || $e instanceof APIException) { $e = new Exception($e->getMessage(), 500); } $response->setException($e); } $response->send();