Get or create a direct space with another user. Currently, this method will only work if the two users are in the same company or have been in same space. If one user is an anonymous user, they must both be online in the same space.

URL Parameters

NameDescriptionLocationRequiredDefault Value
userTypeThe type of user that the direct space is being created with. 'user' or 'anonymous'.PathYes
userIdThe ID of the user.PathYes

Authentication

JwtAuthenticator, Oauth2Authenticator, AnonymousAuthenticator

Authorization

OAuthAuthorizer and PERM_TOPIC_READ

Example Request

URL

GET https://spacesapis.zang.io/api/spaces/direct/{userType}/{userId}

Headers

Authorization: "jwt eyJhbGciOiJSUzI1NiIsIdfgdfgnR5cCI6IkpXVCJ9.eyJ1c2VyX2lkX3NpZyI6ImxPWHpxNzVzR3J3X0xwWEMyRGRMakhyYXJlWVhyTzFMdEZHZkhkOWNkTXciLCJwcm9kdWN0X3R5cGUiOiJhY2NvdW50cyIsImxhc3R1cGRhdGV0aW1lIjoiMjAxNy0wMS0zMFQxMzo1ODo0Ny4yMDYiLCJpc3MiOiJ6YW5nLmlvIiwicHVibGlja2V5aWQiOiJhZ3h6Zm05dVpYTnVZVEl3TVRSeUdnc1NEVWRLZDNSUWRXSnNhV05MWlhrdfgdWdJQ2dsUEtFakFvTSIsImV4cCI6MTQ5NTM5MTIwMywidXNlcl9pZCI6ImFneHpmbTl1WlhOdVlUSXdNVFJ5RVFzU0JGVnpaWElZZ0lEQXMtX25fUW9NIiwidmVyIjoiMi4wIn0.SqZpw1uPIebqW3qlDsm0-DWYFKEH0SgPwtD-tSESWOF-5hLkZMqJH28ooWux2S7s9riIew7pTVPnZpTgJa5zHcEAG0gXSEJVOqmpGp_4ufM8YtZoZMpBFjyAkwyAt-ILkGUYIo0GU5WyzMPLV8YLXfgdfgOgkE2MGGOajBkjPmC2Db3pA0D0M9k-21EL1gwWBC5YIq0PDAkgulegwl6khRmB8irJQ-dfg-d-KV9eYfFpsCdJKRGzSfqg"

Or

Authorization: "bearer f746696f5de4528u128ae2f274eea253e8a7943a"

Example Response

{
"data": [{
    "uid": "DT_user_588d08e53bab0e18ff043f12&user_5890b1243bab0e18ff044943",
    "cid": "588d08e53bab0e18ff043f12",
    "_id": "590393f4e2cda45e3bbbfc79",
    "restrict": [],
    "status": 0,
    "members": [{
        "member": "5890b1243bab0e18ff044943",
        "memberType": "userId",
        "role": "admin",
        "joinTime": "2017-04-28T19:11:48.635Z",
        "username": "patrickhan@esna.com",
        "displayname": "Patrick-123 Han-han",
        "picture_url": "https://storage.googleapis.com/onesnatesting/pictures/pfpic_user_287f310f-aba5-4879-a18e-247c07c4894a"
    }, {
        "member": "588d08e53bab0e18ff043f12",
        "memberType": "userId",
        "role": "admin",
        "joinTime": "2017-04-28T19:11:48.635Z",
        "username": "hanzhihong8@gmail.com",
        "displayname": "Patrick Han",
        "picture_url": "https://lh3.googleusercontent.com/-fT8wTEqCj5E/AAAAAAAAAAI/AAAAAAAAACo/lsu6v0k8C48/photo.jpg"
    }],
    "parents": [],
    "settings": {
        "confId": "405363542",
        "mdOpts": [],
        "mdSrv": "ams"
    },
    "created": "2017-04-28T19:11:48.766Z",
    "type": "direct"
}]
}