• JoeyDumont
    0
    Hi,

    How do you determine the user prefix in the backend storage (in my case, S3)?

    For instance, I know that a given user will have its files prefixed with
    MBS-<really_long_string_that_looks_like_a_hash_of_some_sort>/<computer_hostname>/
    
    in the S3 bucket. How do you determine the string that looks like a hash?

  • MattAccepted Answer
    91
    For security purposes that string is assigned randomly.
    If you copy that string, edit any user in your web dashboard and paste it in the address field of your browser instead the user you're currently editing the page will open the user which that string belongs to.
  • JoeyDumont
    0
    Will that also work with the API?
  • JoeyDumont
    0
    In case somebody was wondering, this is how you'd determine the random ID given to a user using the API.

    # -- Start a requests Session.
    session = requests.Session()
    
    # -- Get an access token the API credentials generated in the management
    # -- console, and prepare the header for future requests.
    response  = session.post("https://api.mspbackups.com/api/Provider/Login",json={"UserName": config['mbs_api_auth']['UserName'], "Password": config['mbs_api_auth']['Password']})
    json_test = json.loads(response.text)
    
    session.headers = {"Accept": "application/json",
                       "Authorization": "Bearer {}".format(json_test['access_token'])}
    
    # -- Get the list of users.
    response  = session.get("https://api.mspbackups.com/api/Users")
    user_list = json.loads(response.text)
    
    # -- Determine the user ID from their user account, stored in the email field
    # -- for some reason.
    for element in user_list:
      if element['Email'] == args.user:
        print("User {} has ID {}".format(args.user,element['ID']))
    
  • Steve Putnam
    35
    For us plain old users, I finally found out that you can get the MBS prefix code by clicking on the icon next to each user in the user tab. Wish I knew that years ago :)
  • Andy Hicks
    0
    Joey, thanks for posting this code. It helped me get connected to the API.
bold
italic
underline
strike
code
quote
ulist
image
url
mention
reveal
youtube
tweet
Add a Comment