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

Developers

Creating Spaces using API

Comments

7 comments

  • Avatar
    Miguel Estrada

    Hello Niels,

    Creating a space is supposed to work ONLY when an app is acting as a user (via code grant oauth2 flow) but we are investigating solution to a defect that is currently preventing this.  Will ask for an ETA on this internally...

    The reason for restricting apps from creating spaces when acting as themselves is because all spaces must be tracked to a human for various reasons such as compliance, etc...

    Now, you mentioned you are authenticating as a user...  Do you mean acting as a user as above?  If so, curious too as to how you are doing this.  We have another work in progress that should be available hopefully today to enable one to enter a redirect url for the oauth flow in the UI when registering applications.

  • Avatar
    Niels Boumans

    Yes I mean acting as a user. We do that by redirecting the user to the /oauth/authorize url and handling the callback.

    As for the use case for creating Spaces as an app:

    We had in mind to integrate the messages of a space in our own UI. The App would retrieve the conversation and show it to the user. 
    The idea was to have both workspace users and non-workspace users in the space. The workspace users send messages on behalf of their own account using the "Acting as user"-oauth
    The non-workspace users send messages using the "As an app"-oauth

    In this situation we would like to generate the space on the fly. So when sending the first message is sent to a space. (this way we won't need to create spaces that are never used) 
    Most of the time the first message will be a question sent by the non-workspace user and therefore the app will be generating the space using the "As an app"-oauth

     

  • Avatar
    sveta goldstein

    Hi Niels,

    Did you solve this one? Having the same problem the "getMyself" query returns me user (not app), but "createSpace" mutation returns me 403

  • Avatar
    Niels Boumans

    It seems you are authenticated correctly if the getMySelf returns the user.
    So when you call createSpace with the same authentication it should work. 

    My problem was that I wanted to authenticate as an app. I guess, that still is not supported

    You can test the query with the API graphQL explorer.
    https://workspace.ibm.com/graphql?query=mutation%20createSpace%20%7B%0A%20%20createSpace(input%3A%20%7Btitle%3A%20%22Space%20title%22%2C%20members%3A%20%5B%22user1-id%22%2C%20%22user2-id%22%5D%7D)%20%7B%0A%20%20%20%20space%20%7B%0A%20%20%20%20%20%20id%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D%0A 

  • Avatar
    sveta goldstein

    'createSpace' mutation works in explorer, access_token is fine, 'getMyself' works and returns me user, but 403 when I'm creatingSpace from app.

    Is it scope? I have 'read write' currently

  • Avatar
    LUIS FELIPE FLOREZ LEANO

    Hello any updates for this, I am able to create an space using the accessToken from the Oauth flow, but I am not able to add an app into that space, any one know if this is possible?

     

    Thank you very much.

  • Avatar
    Miguel Estrada

    Hello Luis.

     

    This thread originated with being able to create a space as an app operating under a given user's authority/identity. This was fixed already as you mentioned.  The ability to add an app to a space by an app that is authorized by a user is a separate issue which is known and being addressed. Targeting over the next couple of weeks at the moment.

Please sign in to leave a comment.