Members can be added to a Space through the "addSpaceMembers" mutation on a WWClient or WWGraphQLEndpoint. The method takes a List of SpaceMemberObject objects. The SpaceMemberObject takes an id for the person and permissions. The permissions are not yet in use, so just pass a blank string. The methods return an ArrayList of members IDs added.

@Test(enabled = true)
@Parameters({ "appId", "appSecret","space2Id", "profileId" })
public void addMembersToSpace(String appId, String appSecret, String space2Id, String profileId) throws WWException, UnsupportedEncodingException {
    WWClient client = WWClient.buildClientApplicationAccess(appId, appSecret, new WWAuthenticationEndpoint());
    List<SpaceMemberObject> members = new ArrayList<SpaceMemberObject>();
    SpaceMemberObject obj = new SpaceMemberObject("1281ac4d-74f1-4aaa-bbb7-29123410aaa3", "");
    List<String> ids = client.addSpaceMembers(space2Id, members);
    assert ids.size() == 1;