Watson Workspace will no longer be available after February 28, 2019. Learn more.

Developers

API GraphQL addMessageFocus call error

Comments

3 comments

  • Avatar
    Darren Cacy

    GraphQL can be finicky. Have you tried Van Staub's unofficial SDK? It removes some of the complexity of working with the API.  Check it out here: https://github.com/van-ibm/watsonworkspace-sdk.

  • Avatar
    Miguel Estrada

    I reproduced your problem and found that you need to add a version for this to work.

    Documentation says it is optional, but it does not seem to be.  Will get this corrected.

    mutation patrick_test {
    addMessageFocus (input:
    {
    messageId:"5a33e9d3e4b0c96be5e69e30",
    messageFocus: {
    lens:"MyLens",
    phrase:"TEST"
    version: 1
    }
    })
    {
    message
    {
    id
    content
    annotations
    }
    }
    }

     

  • Avatar
    DANIEL KILPATRICK

    Thank you all for the responses. As Miguel states, the version parameter is a required field. Also the start and end parameters are need for the phrase to be underlined for the end use (so start: 0 end: 3 in this example). Finally, the http header x-graphql-view must be set and have the value PUBLIC, BETA (while this API is in beta) for the call to work.
    There are some great examples shared in GitHub to support the documentation, so now I'm up and running. Thanks again.

Please sign in to leave a comment.