Partner-Center-PowerShell icon indicating copy to clipboard operation
Partner-Center-PowerShell copied to clipboard

Test-PartnerAddress not working anymore

Open DonEmmaPerez opened this issue 3 years ago • 4 comments

The procedure worked fine the last months. Now it suddenly stopped working, my script hasn't changed.

Steps to reproduce

Using the example from docs (after logging in via Connect-PartnerCenter): Test-PartnerAddress -AddressLine1 '700 Bellevue Way NE' -City 'Bellevue' -Country 'US' -PostalCode '98004' -State 'WA'

Expected behavior

Address should get verified

Actual behavior

An error gets thrown: Test-PartnerAddress : Unexpected character encountered while parsing value: {. Path '', line 1, position 1.

Debugging I can see, that the HTTP Request to the Partner Center API seems to work fine:

DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST

Absolute Uri:
https://api.partnercenter.microsoft.com/v1/validations/address

Headers:
Accept                        : application/json
MS-PartnerCenter-Client       : Partner Center PowerShell
MS-CorrelationId              : "GUID"
X-Locale                      : en-US
MS-RequestId                  : "GUID"
MS-SdkVersion                 : 1.15.6.0

Body:
{
  "AddressLine1": "700 Bellevue Way NE",
  "City": "Bellevue",
  "Country": "US",
  "PostalCode": "98004",
  "State": "WA"
}

And the HTTP Response is working aswell:

DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK

Headers:
Transfer-Encoding             : chunked
Request-Context               : appId=...
MS-CorrelationId              : "GUID"
MS-RequestId                  : "GUID"
X-Locale                      : en-US
Date                          : Wed, 28 Jul 2021 06:47:34 GMT

Body:
{
  "originalAddress": {
    "country": "US",
    "city": "Bellevue",
    "state": "WA",
    "addressLine1": "700 Bellevue Way NE",
    "postalCode": "98004"
  },
  "suggestedAddresses": [
    {
      "country": "US",
      "city": "Bellevue",
      "state": "WA",
      "addressLine1": "700 Bellevue Way NE",
      "postalCode": "98004-5046"
    }
  ],
  "status": "VerifiedShippable"
}

After that the procedure fails with "Unexpected character encountered while parsing value: {. Path '', line 1, position 1"

DonEmmaPerez avatar Jul 28 '21 08:07 DonEmmaPerez

Same problem is occurring with New-PartnerCustomer cmdlet.

mprentice22153 avatar Aug 09 '21 20:08 mprentice22153

@mprentice22153 We replaced the Test-PartnerAddress function with a direct call to the Partner Center API. We are still using New-PartnerCustomer, we just had to add -DisableValidation so the Address does not get checked again, but the cmdlet works without the validation.

DonEmmaPerez avatar Aug 20 '21 09:08 DonEmmaPerez

We experienced the same error with New-PartnerCustomer cmdlet, as @DonEmmaPerez mentioned as a workaround we have added SwitchParameter -DisableValidation and It works without the validation.

DEBUG: ============================ HTTP RESPONSE ============================ Status Code: OK

Headers: Transfer-Encoding : chunked Request-Context : appId=cid-v1:03ce8ca8-8373-4021-8f25-d5dd45c7b12f MS-CorrelationId : f800fa78-57f1-4a3a-a5ad-66db157e736b MS-RequestId : a57b6414-3820-46e1-b3ed-c3ff29eaefc7 X-Locale : en-US Date : Thu, 26 Aug 2021 04:00:29 GMT

Body: { "originalAddress": { "country": "NO", "city": "Oslo", "addressLine1": "OsloTwelve", "postalCode": "1371" }, "suggestedAddresses": [ { "country": "NO", "city": "Oslo", "addressLine1": "OsloTwelve", "postalCode": "1371" } ], "status": "Verified" }

New-PartnerCustomer: Unexpected character encountered while parsing value: {. Path '', line 1, position 1.

sabirmohamed avatar Aug 26 '21 05:08 sabirmohamed

@DonEmmaPerez Thank you. The parameter solved my issue.

mprentice22153 avatar Nov 02 '21 18:11 mprentice22153