Creating new members through Ektron CMS400.NET API: How to do it?

I’m trying to add new members to my Ektron CMS400.NET site using the User web service API from another site. I want to use the AddMembershipUser method but it says I need admin rights. I’ve already set up the AuthenticationHeaderValue for remote calls and used the LogInUser method to log in as an admin. It seems to work fine.

The problem is I can’t figure out how to run AddMembershipUser as the admin I just logged in. I’ve asked Ektron support and looked through forums and docs but no luck so far.

Has anyone done this before? How do you call API methods as a user you’ve logged in through code from a different server? Any tips would be great!

Here’s a simplified example of what I’m trying to do:

var client = new UserServiceClient();
client.LogInUser('admin', 'password', 'domain', 'site', 'key');

var newUser = new UserData
{
    Username = 'newmember',
    Password = 'newpass',
    Email = '[email protected]'
};

client.AddMembershipUser(newUser);

But this doesn’t work as expected. Any ideas?

hey, i had similar probs with ektron api. try using the token from LogInUser like this:

client.ClientCredentials.UserName.UserName = authToken;

before calling AddMembershipUser. it shud keep ur admin session going. if it dont work, check ur admin perms in ektron. good luck!

I’ve encountered a similar issue when working with the Ektron API. The key is to make sure you’re passing the authentication token correctly after logging in. Try modifying your code to capture the authentication token returned by LogInUser, then set it on the client before making subsequent calls:

var client = new UserServiceClient();
var authToken = client.LogInUser('admin', 'password', 'domain', 'site', 'key');
client.ClientCredentials.UserName.UserName = authToken;

var newUser = new UserData
{
    Username = 'newmember',
    Password = 'newpass',
    Email = '[email protected]'
};

client.AddMembershipUser(newUser);

This should allow you to maintain the admin session for subsequent API calls. If you’re still having trouble, double-check that your admin account has the necessary permissions in Ektron to create new users.

I’ve dealt with Ektron’s API before, and it can be tricky. One thing that worked for me was using the token from LogInUser in a slightly different way. Instead of setting it directly on the client credentials, try adding it as a custom header:

var client = new UserServiceClient();
var authToken = client.LogInUser('admin', 'password', 'domain', 'site', 'key');

client.ChannelFactory.Endpoint.Behaviors.Add(new CustomHeaderBehavior(authToken));

var newUser = new UserData
{
    Username = 'newmember',
    Password = 'newpass',
    Email = '[email protected]'
};

client.AddMembershipUser(newUser);

You’ll need to create a CustomHeaderBehavior class to add the token to each request. This approach helped me maintain the admin session across multiple API calls. If you’re still stuck, you might want to check the API logs on the Ektron server for more detailed error messages.