Bubble Not Accepting Date via API For Some Reason

I have a mobile app that is sending an iOS “date” or “Foundation/Date” data type to a Bubble Date but each time I hit the endpoint with the Foundation/Date unix timestamp it tells me Bubble expects a date but received a String.

I thought that Bubble could accept a unix timestamp to a Bubble Date receiving endpoint?

Or is the fact I’m sending it as a Foundation/Date/Timestamp inside of the ios app?

Should it be sent as a straight string to a bubble date? I don’t think I can bind a string to a Bubble date if this is the solution…

Have you tried using ISO 8601 format - e.g. a string like "1999-10-20T14:35:34.000Z"?

I just defined an API call in Bubble using a string formatted as such and then telling Bubble it was a “date” type. Just a thought…

I can’t bind a string within the app to a date on the bubble side is the issue.

Can you show the output it give?
Date format doesn’t exist in JSON or url parameters. So they will be string. But I believe that the format used by iOS may not match what is expected by Bubble.
Also, can you show the setting of your API Workflow? (parameters)

I too think it may be a setting within the app builder.

The page variable is set to Foundation/Date data type and is the only iOS “date” i could select.

image

On the Bubble end, it’s set to receive a ‘date’ as well.

image

Can you switch to initialize and send the request and post the screenshot of the parameters?
We will see what exactly is sent. Even if you set Date, there’s a lot of way to format date.
Is there an option in data type / foundation / timestamp instead of date?

I’m not familiar with the app builder in your screenshot, but a couple thoughts… Is there any way to convert the date into a string? Or to multiply the timestamp by 1000? (If Bubble accepts a timestamp, it might require it to be in milliseconds instead of seconds.)

1 Like

This is the error.

Keep in mind that it works fine with an android app date/date but with ios it’s all wonky:

{“statusCode”:400,“body”:{“status”:“INVALID_DATA”,“message”:“Invalid data for key date: Expected a date, but got a string (original data: “1567090560.0”)”},“args”:{“bubble_code”:“1567004152383x326404708418242600”}}

According to @seanhoots this should be as straightforward as selecting a Date data type in Dropsource and setting a Date data type in Bubble.

It’s wierd that it’s not ‘accepting’ it but i’m unconfident my variable date date type on ios of “Foundation/Date” is correct all together…

1 Like

Did ypu set initialize for auto detect params. You can also send the request to a requestbin. What we need to see is what is sent to bubble

If that’s what’s coming to Bubble from the outside, it looks like neither a timestamp nor an ISO 8601 date string. :neutral_face:

1 Like

I can’t without modifying the swaggar and taking many other steps to hit that /initialize url.

All i know is it works fine and accepts a date from an android app (Java/Date) data type but iOS is different and uses Foundation/Date it seems inside of Dropsource. I’m not sure that’s the right setting.

It is in seconds from EPOCH so UTC:

image

But Bubble says it’s coming as a string with a period (decimal point) in it, so it doesn’t recognize it as a timestamp.

This is the problem. Its not one of the format expected by Bubble. What option do you have in last dropdown?sorry. I should first say that I missed the error message the period is thr issue

1 Like

I think so as well.

The last window:

image

and:

image

image

I removed that trailing .0 and it doesn’t want to work either unfortunately.

A timestamp must be an integer number, and Bubble might also require it to be in milliseconds, so if you removed the quotes and added 3 zeros in place of the “.0”, then it might work.

1 Like

I dont see any other option. And i dont think theres a plugin that can convert it actually

1 Like

The solution was to set the page variable to Integer instead of Foundation/Date and it worked.

@sudsy it was your comment that sparked my mind on this after a day at it, thank you!

2 Likes