Legacy Dev Forum Posts

 View Only

Sign Up

Confusion using post /api/v2/contentmanagement/query with OAuth client

  • 1.  Confusion using post /api/v2/contentmanagement/query with OAuth client

    Posted 06-05-2025 18:25

    Paul_Lewis | 2023-02-20 23:41:56 UTC | #1

    My use case is simple. Translating a script from one Org to another. Quite a simple job - just need to replace UUID's for contactList, Document and DataAction in the source org version to produce the JSON of the dest version. All works great except I can't seem to retrieve a document by name using OAuth. Using the same OAuth client I can retrieve the document by ID but of course I don't already know the ID hence having to use POST to Query.

    Here's a simplified example (the document is shared to all and is named "reload.png") POST BODY

    { "pageNumber": 1, "pageSize": 50, "includeShares": true, "filters": [ { "name": "name", "type": "STRING", "operator": "EQUALS", "values": [ "reload.png" ] } ] }

    Here is the result using OAuth { "results": { "entities": [], "pageSize": 50, "pageNumber": 1, "total": 0, "firstUri": "/api/v2/contentmanagement/query?pageSize=50&pageNumber=1", "lastUri": "/api/v2/contentmanagement/query?pageSize=50&pageNumber=1", "selfUri": "/api/v2/contentmanagement/query?pageSize=50&pageNumber=1", "pageCount": 0 } }

    Here is the result using User Credential under API Explorer tool from Genesys. I have only included the first few lines for brevity. { "results": { "entities": [ { "body": { "id": "e3c15a76-8cc1-4604-8313-6120ead6f577", "name": "reload.png", "changeNumber": 7, "dateCreated": "2022-03-16T21:00:20.314Z", "dateModified": "2022-03-16T21:10:32.843Z", "dateUploaded": "2022-03-16T21:10:32.843Z", ...

    I cannot see any reason other than the particular API must not like OAuth credentials. Hopefully it's simpler than that and it's a mistake someone wiser can point out.

    I can affect the outcome by removing the permission "General Content Management / User" Then, the output is indicating a permission issue (maybe?) even though the documentation says no permissions required. { "message": "Requested action forbidden", "code": "forbidden", "status": 403, "messageParams": {}, "contextId": "4344ab09-0a4b-4720-a31c-b94001f0bc7a", "details": [], "errors": [] }

    Note that the API query GET /api/v2/contentmanagement/documents/{documentId} Works regardless of whether the OAuth user has that permission above or not.

    Conclusion: The documentation is wrong and there is some permissions required that I haven't guessed. OR the API is wrong and is not working for OAuth users.

    Please if anyone can have a peek and spot my mistake or confirm my conclusion it'd be a help!


    tim.smith | 2023-02-21 21:33:47 UTC | #2

    The same request made using different auth tokens can yield different results for various reasons. Some of the common causes are differences in division permissions or the resource you're using operates in context of the current user. If you need assistance determining why the results are different between requests, please open a case with Genesys Cloud Care to investigate further as customer-specific data cannot be investigated via the forum.


    system | 2023-03-24 22:31:01 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 18493