locked
Getting started - how to supply auth info RRS feed

  • Question

  • Hi Guys,

    I'm trying to get started using the API and not getting very far.

    I have a:
    - UserName
    - Password
    - Token

    My understanding is that I should simply be able to import this WSDL file and call GetAccounts.
    https://sandboxapi.adcenter.microsoft.com/Api/Advertiser/V5.1/CustomerManagement/CustomerManagement.asmx?wsdl

    So I've added the reference and declared:
    using MSSOAP3.com.microsoft.adcenter.sandboxapi;

                MSSOAP3.com.microsoft.adcenter.sandboxapi.CustomerManagement mgmt = new CustomerManagement();
                try
                {
                    AdCenterAccount[] myAccounts = mgmt.GetAccounts(1);
                }
                catch(Exception e)
                {
                    Console.WriteLine(e.Message);
                }

    Clearly I'm not passing any authentication information to this and the GetAccounts call does not seem to take any as a parameter.

    How on earth does one provide the auth info?

    Thanks
    Warrick
    Tuesday, April 7, 2009 7:08 PM

Answers

  • I "think" I've found my answer.

                ApiUserAuthHeader authHdr;
                authHdr = new ApiUserAuthHeader();
                authHdr.UserName = "xxxxxx";
                authHdr.Password = "xxxxxx";
                authHdr.UserAccessKey = "xxxxxxxx";

                CustomerManagement mgmt = new CustomerManagement();
                mgmt.ApiUserAuthHeaderValue = authHdr;

    This did not seem that easy to find in the documentation, so I hope this post helps the next poor sod :)

    I'm still getting this error ""Server was unable to process request. ---> |-400001|-1|API unauthorized access|", but I suspect it's because my account has been locked out at this point.
    • Marked as answer by Wozza99 Wednesday, April 8, 2009 12:56 PM
    Wednesday, April 8, 2009 12:56 PM

All replies

  • I "think" I've found my answer.

                ApiUserAuthHeader authHdr;
                authHdr = new ApiUserAuthHeader();
                authHdr.UserName = "xxxxxx";
                authHdr.Password = "xxxxxx";
                authHdr.UserAccessKey = "xxxxxxxx";

                CustomerManagement mgmt = new CustomerManagement();
                mgmt.ApiUserAuthHeaderValue = authHdr;

    This did not seem that easy to find in the documentation, so I hope this post helps the next poor sod :)

    I'm still getting this error ""Server was unable to process request. ---> |-400001|-1|API unauthorized access|", but I suspect it's because my account has been locked out at this point.
    • Marked as answer by Wozza99 Wednesday, April 8, 2009 12:56 PM
    Wednesday, April 8, 2009 12:56 PM
  • Try logging into the UI with your username and password. That will let you know if your account has been locked out. If you can log in, please post your SOAP information here, along with the web service URL you are using, and the SOAP Action.

    Jeff Dillon, API Support
    Thursday, April 9, 2009 11:29 PM