web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to properly send D...
Power Apps
Unanswered

How to properly send DateTime value to custom api?

(0) ShareShare
ReportReport
Posted on by 78

I have a custom web api method written in C# that accepts DateTime argument.

 

public int GetUpdateCount(DateTime lastDate, string category) { ... }

 

When I tried to call api method in my PowerApps application and use Now() function

 

MyApi.NewsGetUpdateCount(Now(), "category")

 

I got the error that first argument has to be of type Text. So I tried

 

MyApi.NewsGetUpdateCount(Text(Now(), "yyyy-MM-dd HH:mm:ss"), "category"))

But now I get an error from my server: A potentially dangerous Request.Path value was detected from the client ( : ). Which is, as I guess, because of colon marks (HH:mm:ss). How do I properly send a DateTime value to my api?

 

 

Categories:
  • Matthieu Profile Picture
    67 on at

    Hi,

     

    This is just a workaround but try to insert the formated date (https://powerapps.microsoft.com/en-us/tutorials/show-text-dates-times/)  in a context variable and use the variable as a parameter with your api

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard