question

rmroch avatar image
rmroch asked ·

Alexa Skills Kit Shopping List Web API GET Internal Server Error

Hello,

I am able to use the Get lists metadata Web API to get the lists and their Ids. When I use the Ids in the Get a list Web API I get an internal server error as a response. Does it look like I am doing this correctly?

private AlexaList GetAlexaListByListId(string consentToken, string listId, string status)
{
    _logger.Info("GetAlexaListByListId");
    AlexaList alexaList = null;


    // https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/access-the-alexa-shopping-and-to-do-lists
    string requestUrl = string.Format("https://api.amazonalexa.com:443/v2/householdlists/{0}/{1}", listId, status);
    _logger.Info(requestUrl);
    try
    {
        using (HttpClient client = new HttpClient())
        {
            client.BaseAddress = new Uri(requestUrl);
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", consentToken);
            Task<HttpResponseMessage> getTask = client.GetAsync(requestUrl);
            getTask.Wait();
            HttpResponseMessage httpResponseMessage = getTask.Result;
            if (httpResponseMessage.IsSuccessStatusCode)
            {
                string result = httpResponseMessage.Content.ReadAsStringAsync().Result;
                _logger.InfoFormat("result: {0}", result);
                alexaList = JsonConvert.DeserializeObject<AlexaList>(result);
            }
            else
            {
                _logger.Info("Failed call to get list by id.");
                _logger.Info(httpResponseMessage.IsSuccessStatusCode);
                _logger.Info(httpResponseMessage.ReasonPhrase);
                _logger.Info(httpResponseMessage.Content);
            }
        }
    }
    catch (Exception ex)
    {
        _logger.ErrorFormat("Error: {0}", ex.Message);
        throw ex;
    }

    return alexaList;
}
alexa skills kitalexa lists
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Levon@Amazon avatar image
Levon@Amazon answered ·

Hi rmroch,

This could have been due to an already fixed bug -- probably you were in an Amazon household -- we could verify that given customer ID.

Can you please try again now? And if the issue still persists, then share the customer ID as advised above? Thanks!

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmroch avatar image
rmroch answered ·

I tried this with another user's account and it worked fine. It is just failing on my account both lists.

1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Could it be caching in some way then for your dev environment, was it the same PC?

0 Likes 0 ·
Levon@Amazon avatar image
Levon@Amazon answered ·

Hi rmroch,

Thanks for posting! That's unusual, that it works for another user, but not you. Could we please request your customer ID, so we could investigate this? Please do not post any personal info on this public forums, but instead login to your Dev Portal account and raise a "Contact Us" case with us, specifying your customer ID, any other relevant info, and include the URL to this forum post for context. Thanks!

10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.