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

Developers

Looking for GraphQL query deleting the message

Comments

3 comments

  • Avatar
    ANDREW PENROSE (Edited )

    Hi Vitalijus,

    When making the request for deleteMessage you need to add as specific header , namely:

    x-graphql-view: PUBLIC,EXPERIMENTAL 

    This will give you access to make the call. In your app you can then test delete of message created by an app, or you if your app is running as a particular user , you can delete messages that that user has created.

     

  • Avatar
    Vitalijus Rudzinskas (Edited )

    Thank you, Andrew, trying it out now.

    Still getting "Invalid Syntaxis", but at least I can see "x-graphql-view: PUBLIC, EXPERIMENTAL
    Authorization: Bearer ..." in the header and I have a chance now.

  • Avatar
    Vitalijus Rudzinskas

    Yeah, it works now.

    After adding: 

    "x-graphql-view: PUBLIC, EXPERIMENTAL"

    to the header and setting request body to:

    String body = "mutation {" +
    " deleteMessage(input: {id: \""+messageID+"\" }) {" +
    " successful" +
    " }" +
    "}";

    I can delete the messages posted by app.

    Stay smart and beautiful, Andrew !

Please sign in to leave a comment.