Need help using date calculator API

Hi all,
I need some help using an API with a POST call to subtract a certain number of days from a date.

This is the API I’m trying to use.

I have tried a few methods of calling the API but all are returning a status of 415.


Thanks!

1 Like

415 means the supplied data is not in the correct format.

1 Like

Ahhh. Here is the link the website of the API I’m using: DateCalculatorUi
This is my first time using a pOST call so I’m unsure of the correct format.

1 Like

Aha! I figured out the issue: I needed to add the header with content-type and accept fields.
Here’s a screenshot for anyone else who faces the same problem:

I’ve read a lot of posts from people who want to calculate dates by adding/ subtracting days, I finally found this API which works really well.

1 Like

image

You only need to add the content type

image

1 Like

Is this API still working yet? I tried to access since last week with no success… :frowning:

@muneer or @codeswept do you know something?

2 Likes

Unfortunately, the web service is no longer available.

You need to find a similar service.

1 Like

That’s the problem to develop apps with external dependencies… Due the lack of support on date calculation in Thunkable it’s hard to deal with dates without external APIs…

@muneer I was thinking in develop an internal function to calculate dates difference or sum / subtract days from a date and avoid this kind of external dependency… Do you know any public project with this function done to use as model?

1 Like

Check this project.
https://x.thunkable.com/projectPage/60d06b27eb9be10011749fcd

This is based on JavaScript

You can enter the date and then enter the number of days (+ / -) and you will get the date.

Another way is to connect a Google sheet to the project and calculate dates in the sheet and get the result as you would do with data records.

5 Likes

@muneer do you have this project done in Thunkable X ?

I’m not familiar with this new version and I see some differences in the webAPI component in the new and old version.

I tried to implement in the version X, but I didn’t find the method POST MESSAGE in the component…

Any help will be appreciated!

Thanks

1 Like

Thunkable X is the current version of Thunkable and includes both the Snap to Place (StP) and Drag and Drop (DnD) interfaces. API blocks are found here:

Snap to Place

After you drag a Web API component to a screen, you’ll see this in the Blocks tab:



Drag and Drop

After you add a Web API, you’ll see this in the Blocks tab under the Advanced section:

1 Like

@tatiang , Please check the example project posted by @muneer above…

You’ll see that the webAPI component is quite different… so that’s why I can’t use in the older version X of thunkable…

There is no way to implement same same way in the two version, so I asked if he have an example in the X version.

1 Like

I did not use the Web API component. I used a Web Viewer

1 Like

I was only responding to your question about where to find the API POST command. Sorry if that wasn’t helpful.

Edit: Ah, @muneer’s comment directly above helps explain the confusion.

2 Likes

Yes, I see my mistake… :slight_smile:

Thank you for your supportive attitude !!!

2 Likes