[OneSignal Plugin Sample] Receiving 400 Bad Request

Forge Component
(2)
Published on 14 Jan by Daniel Martins
2 votes
Published on 14 Jan by Daniel Martins

Hi,


I did try to run the application but it is giving me 400 bad request. Please help me solve it.


I am using OutSystems11. I have installed the application on an android device. The application is not running through OutSystems now app. It is really necessary for me do help me.


Regards,

Manthan Shah.

Hi Manthan,

Which version of android?

Hi,


I am using android version 7.0.

Regards,

Manthan Shah.

Swatantra Kumar wrote:

Hi Manthan,

Which version of android?

Hi any solution?

Manthan Shah wrote:

Swatantra Kumar wrote:

Hi Manthan,

Which version of android?

Hi any solution?

Hi

I am experiencing the same issue, did you find a solution



Hello, the official new OneSignal component from OutSystems has a bug in populating the send_after property internally the component checks if this property is not sent and if it does not populate with CurrDateTime () this will work when the server is set to the American date standard. Just open the OneSignalAPI project in the ServerActions / PushNotifications / PostNotification folder and change the Assign in Has Deeplink's false option to

SyntaxEditor Code Snippet

If(DateTimeToDate(SendAfter) = NullDate(), "", SendAfter)

rather than

If(DateTimeToDate(SendAfter) = NullDate(), CurrDateTime(), SendAfter)


this will solve your bad request, unfortunately even filling in the property will continue with error because the property is like datetime not giving you the freedom to set it the correct in this case would the property be text to each format appropriately according to your situation or a better intelligence within the component to do this taking the format OneSignal hopes to achieve.

In addition to the above steps it is necessary to remove the Default value that is like CurrDateTime () from the SendAfter input variables of the PostNotification and SendPushNotificationToUserId methods otherwise even if empty the component will insist on sending the date and time in the wrong format.

Hope this helps.

Cheers,
Nuno Verdasca

You can try to solve the problem by following these steps:

  1. Change the Initial_Date and DateFormate parameters of Input_Caledar to the following values:
    1. InitialDate: SyntaxEditor Code Snippet
      AddHours(CurrDateTime(),-3)
    2. DateFormat: SyntaxEditor Code Snippet
      "%Y/%m/%d %H:%M:%S"
  2. In the SendPushNotificationToAll function, which I decided to use, I set the value of the SendAfter parameter as follows:
    1. SendAfter: SyntaxEditor Code Snippet
      AddHours(NotificacaoForm.Record.Notificacao.Data,3)

This solved the "400 Bad Request" problem and I was able to set the scheduling date and time correctly in the OneSignal API.

Cheers,
Nuno Verdasca

Nuno Miguel Verdasca wrote:

You can try to solve the problem by following these steps:

  1. Change the Initial_Date and DateFormate parameters of Input_Caledar to the following values:
    1. InitialDate: SyntaxEditor Code Snippet
      AddHours(CurrDateTime(),-3)
    2. DateFormat: SyntaxEditor Code Snippet
      "%Y/%m/%d %H:%M:%S"
  2. In the SendPushNotificationToAll function, which I decided to use, I set the value of the SendAfter parameter as follows:
    1. SendAfter: SyntaxEditor Code Snippet
      AddHours(NotificacaoForm.Record.Notificacao.Data,3)

This solved the "400 Bad Request" problem and I was able to set the scheduling date and time correctly in the OneSignal API.

Cheers,
Nuno Verdasca


Thank you so much for the reply, I found out that my problem was caused by MABS version that the app was configured to and after configuring it to a lower version 3.3 it worked perfectly.