Reply
Contributor
Posts: 25
Registered: ‎09-29-2016

C# Api getCustomerProfileRequest null response

I'm trying to test the getCustomerProfileRequest in the C# api but my response is always null. This is what i have so far:

 

ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = AuthorizeNet.Environment.SANDBOX;
      ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
      {
        name = _credentials.LoginId,
        ItemElementName = ItemChoiceType.transactionKey,
        Item = _credentials.ApiKey
      };

      var request = new getCustomerProfileRequest { customerProfileId = customerProfileId.Value };

      var controller = new getCustomerProfileController(request);
      controller.Execute();

      var response = controller.GetApiResponse();

Is there any reason this would be null? It's not invalid credentials or anything like that. Always null. If I put in invalid credentials the result will be an error saying invalid credentials. I know for a fact there is a customer profile for the given customerProfileId because results are returned by the soap requests.

Contributor
Posts: 25
Registered: ‎09-29-2016

Re: C# Api getCustomerProfileRequest null response

I found out the issue. The API key was wrong. However, the api key I was sending through was too long for what the API key expects (which I found by using the "try it" section of the website). It turns out that error is not handled in the api controller and just returns null as a result.

 

Is there any way this can be noted as a future change/fix for the api?

Highlighted
Posts: 2,248
Topics: 51
Kudos: 151
Blog Posts: 64
Registered: ‎12-05-2011

Re: C# Api getCustomerProfileRequest null response

Hello @Devin

 

I would suggest logging an issue in GitHub to notify the development team and get a response when completed.

 

You are also welcome in the future to go ahead and log issues right there too. You can even submit your fix for our review and inclusion: https://help.github.com/articles/using-pull-requests

Richard

--------

Webhooks are now available for Authorize.Net

Using SOAP, see our deprecation notice.
Check out Accept.js, our Javascript replacement for DPM.
Pro Tip: Never use test mode in the sandbox, instead use the Testing Guide.