Issue with Date Format in Web API

DateTime parsing fails when using this API
/api/measures/search_history?component=Care-Guard&metrics=code_smells,vulnerabilities,sqale_index,bugs,coverage,line_coverage,branch_coverage,lines_to_cover,test_success_density,test_errors,test_failures,skipped_tests,duplicated_lines_density,comment_lines_density&from=2017-10-19T13:00:00+0200&to=2017-10-19T13:00:00+0200

  • versions used (SonarQube 7.0)
  • error observed ({
    “errors”: [
    {
    “msg”: “Date ‘2017-10-19T13:00:00 0200’ cannot be parsed as either a date or date+time”
    }
    ]
    })
  • steps to reproduce(hit the above API)
  • potential workaround

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

1 Like

Hi, in my case, the problem was de ‘+’ in the date… Must be urlencoded: %2B

You must call:

/api/measures/search_history?component=Care-Guard&metrics=code_smells,vulnerabilities,sqale_index,bugs,coverage,line_coverage,branch_coverage,lines_to_cover,test_success_density,test_errors,test_failures,skipped_tests,duplicated_lines_density,comment_lines_density&from=2017-10-19T13:00:00%2B0200&to=2017-10-19T13:00:00%2B0200