Code Monkey home page Code Monkey logo

Comments (3)

stoiveyp avatar stoiveyp commented on September 24, 2024

Hi @gdantuono - thanks for raising the issue.

I've just tested the proactive events API with my own example and although there have definitely been some payload schema changes (which I'll have to go through sometime this week and update accordingly) the date format gets accepted with a 202 status code response (relevant snippet of my request shown below)

  "timestamp": "2020-03-03T08:38:01.00+00:00",
  "referenceId": "unique-id-of-this-instance",
  "expiryTime": "2020-03-03T08:50:01.00+00:00",

To help with my investigation, are you able to grab the response body you're sent back with the 400 status you receive? The API is extremely helpful and returns a lot of validation information, if it's date related maybe it can help explain why it's not consistently failing.

Thanks in advance

from alexa.net.proactiveevents.

gdantuono avatar gdantuono commented on September 24, 2024

Hi @stoiveyp
from your example, you can see that the time and minute separator is ":" instead, since I have the Win10 e .NET Framework with Italian language pack, the time and minute separator is ".".

I'm sure the suggested corrective on the EventIsoDateTimeConverter class is decisive and doesn't cause regressions

internal class EventIsoDateTimeConverter : IsoDateTimeConverter
    {
        public EventIsoDateTimeConverter()
        {
            Culture = System.Globalization.CultureInfo.InvariantCulture;
            // DateTimeStyles = System.Globalization.DateTimeStyles.AdjustToUniversal;
            DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ssK";
        }
    }

Below what you asked me.

REQUEST

{
    "relevantAudience": {
        "type": "Multicast",
        "payload": {}
    },
    "timestamp": "2020-03-03T12.56.30+00:00",
    "referenceId": "db0b3204bab84943a4ffbf0fae14be75",
    "expiryTime": "2020-03-04T11.56.30+00:00",
    "event": {
        "payload": {
            "state": {
                "status": "UNREAD",
                "freshness": "NEW"
            },
            "messageGroup": {
                "creator": {
                    "name": "Allerta Server"
                },
                "count": 4
            }
        },
        "name": "AMAZON.MessageAlert.Activated"
    },
    "localizedAttributes": []
}

RESPONSE

{
    "Version": "1.1",
    "Content": {
        "Headers": [
            {
                "Key": "Content-Type",
                "Value": [
                    "application/json"
                ]
            },
            {
                "Key": "Content-Length",
                "Value": [
                    "125"
                ]
            }
        ]
    },
    "StatusCode": 400,
    "ReasonPhrase": "Bad Request",
    "Headers": [
        {
            "Key": "Connection",
            "Value": [
                "keep-alive"
            ]
        },
        {
            "Key": "Server",
            "Value": [
                "Server"
            ]
        },
        {
            "Key": "Date",
            "Value": [
                "Tue, 03 Mar 2020 12:56:41 GMT"
            ]
        },
        {
            "Key": "X-Amzn-RequestId",
            "Value": [
                "2ab8503c-21e4-b199-0c84-017d0d3e5ecc"
            ]
        },
        {
            "Key": "Vary",
            "Value": [
                "Accept-Encoding",
                "X-Amzn-CDN-Cache",
                "X-Amzn-AX-Treatment",
                "User-Agent"
            ]
        },
        {
            "Key": "x-amz-rid",
            "Value": [
                "1KD4M0PKQJFRHRN3Y290"
            ]
        },
        {
            "Key": "X-Cache",
            "Value": [
                "Error from cloudfront"
            ]
        },
        {
            "Key": "Via",
            "Value": [
                "1.1 1b96443527f684c809162d975cdd968f.cloudfront.net (CloudFront)"
            ]
        },
        {
            "Key": "X-Amz-Cf-Pop",
            "Value": [
                "MXP64-C1"
            ]
        },
        {
            "Key": "X-Amz-Cf-Id",
            "Value": [
                "9omjxLqVCyiq5-byQ9bfBU1ShnvJn2L3DdIelIMOT3ubOE4aAl_qMQ=="
            ]
        }
    ],
    "TrailingHeaders": [],
    "RequestMessage": {
        "Version": "1.1",
        "Content": {
            "Headers": [
                {
                    "Key": "Content-Type",
                    "Value": [
                        "application/json; charset=utf-8"
                    ]
                },
                {
                    "Key": "Content-Length",
                    "Value": [
                        "379"
                    ]
                }
            ]
        },
        "Method": {
            "Method": "POST"
        },
        "RequestUri": "https://api.eu.amazonalexa.com/v1/proactiveEvents/stages/development",
        "Headers": [
            {
                "Key": "Authorization",
                "Value": [
                    "Bearer Atc|<access-token>"
                ]
            }
        ],
        "Properties": {}
    },
    "IsSuccessStatusCode": false
}

Thank you very much

from alexa.net.proactiveevents.

stoiveyp avatar stoiveyp commented on September 24, 2024

Thanks for the extra detail @gdantuono - I've updated the culture settings in v1.1.1 which is now released.

I haven't changed the DateTimeStyle as it isn't required to be UTC to work correctly, just the time zone identifier.

Let me know if that sorts out the problem.

from alexa.net.proactiveevents.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.