Legacy Dev Forum Posts

 View Only

Sign Up

Error on PresenceApi#patchUserIdPresencesSourceId

  • 1.  Error on PresenceApi#patchUserIdPresencesSourceId

    Posted 06-05-2025 18:10

    skansakar | 2016-07-26 13:20:35 UTC | #1

    I am trying to change the presence for a user but keep getting Status 405. (See below)

    When I try to change the presence from Postman it seems to work fine.

    Do you know what could be wrong?

    09:24:00,153 ERROR [stderr] (MSC service thread 1-5) SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory] 09:26:10,127 ERROR [stderr] (GT-X UniversalControllerqdof2tjw0G4Buh6lXegS6Rdc.localhost-ekp1) Exception when calling PresenceApi#patchUserIdPresencesSourceId 09:26:11,465 ERROR [stderr] (GT-X UniversalControllerqdof2tjw0G4Buh6lXegS6Rdc.localhost-ekp1) com.mypurecloud.sdk.ApiException: {"status":405,"code":"method not allowed","message":"HTTP 405 Method Not Allowed","contextId":"557438bc-782d-4f6c-8c6d-cc66462895c5","details":[],"errors":[]} 09:26:11,469 ERROR [stderr] (GT-X UniversalControllerqdof2tjw0G4Buh6lXegS6Rdc.localhost-ekp1) at com.mypurecloud.sdk.ApiClient.invokeAPI(ApiClient.java:627) 09:26:11,471 ERROR [stderr] (GT-X UniversalControllerqdof2tjw0G4Buh6lXegS6Rdc.localhost-ekp1) at com.mypurecloud.sdk.api.PresenceApi.patchUserIdPresencesSourceId(PresenceApi.java:305)


    tim.smith | 2016-07-26 13:22:13 UTC | #2

    Can you show me a code snip of your code where you're doing this?


    skansakar | 2016-07-26 13:34:00 UTC | #3

    Sure. I have tried various combinations- including sample code @ https://developer.mypurecloud.com/api/rest/client-libraries/java/latest/PresenceApi.html#patchUserIdPresencesSourceId but keep getting the same error.

    Current code:

    PresenceApi apiInstance = new PresenceApi(); UserPresence body = new UserPresence(); body.setPrimary(true); body.setMessage("a message about my presence"); body.setPresenceDefinition(getPresenceDefinitionFromName(state)); System.out.println(MODULE_NAME + "Body: "+body.toString());

    try { UserPresence result = apiInstance.patchUserIdPresencesSourceId(uniqueUserId, PureCloudChannelProviderConstants.PRESENCESOURCEID, body); System.out.println(MODULENAME + result);

    } catch (ApiException e) { System.err.println("Exception when calling PresenceApi#patchUserIdPresencesSourceId"); e.printStackTrace(); }


    tim.smith | 2016-07-26 15:04:41 UTC | #4

    Ugh. The short answer is that the Jersey HTTP client doesn't support the PATCH method and they are refusing to fix it. Working on figuring out a workaround for the SDK.


    pierrick | 2016-08-01 19:35:20 UTC | #5

    Should be fixed with this: https://developer.mypurecloud.com/forum/t/sdk-update-down-with-jersey-all-hail-apache/187/1


    system | 2017-08-28 19:25:35 UTC | #6


    This post was migrated from the old Developer Forum.

    ref: 177