FRO
FRO

Reputation: 253

Date format in http request

I have to use this URL:

http://localhost/Service/DataService.svc/GetTotalPageForRequestFilter?login=ADM&maxDate=''&statut=1&pageSize=10

But when I use this format I get the error Bad Request - Error in query syntax.

I think, it's my date format which is wrong. What is the format to use in to submit a date to my web service?

maxDate='', it's because maxDate can be null

Here is the signature of my method:

[WebGet]
public int GetTotalPageForRequestFilter(string login, DateTime? maxDate, short? statut, int pageSize)
{
}

Thank you.

Upvotes: 0

Views: 523

Answers (2)

Kyle Undefined
Kyle Undefined

Reputation: 776

Instead of using &maxDate='' just don't put any value there. &maxDate=. As for the error, we need more information to help. Could you post the code that's causing the error?

EDIT: Escape the login parameter with '' and that should work.

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038930

Simply don't include the maxDate parameter if it will be null:

http://localhost/Service/DataService.svc/GetTotalPageForRequestFilter?login=ADM&statut=1&pageSize=10

Upvotes: 1

Related Questions