Creating Asset object via REST API fails with error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

     

Summary

Creating an Asset object via REST API with Date and Time attribute fails with the below error:

2022-04-05T20:59:32.000+0200 is not valid (DateTime)for ISO8601 date 2022-04-05T20:59:32.000+0200 as input.

Environment

  • The issue is expected to occur in any Server/Data center installation of JIRA.

Diagnosis

The precise template for using Date and Time attribute via Rest API is shown below.

Date and Time format should be in ISO Extended format to create an object via Rest API. In ISO 8601, date and time are connected by "T" and written. The time zone is expressed as "+09:00" as the difference time from UTC, and in the case of UTC, it is expressed as "Z".

Separate seconds and milliseconds with a comma (,) or dot (.). DenCode omits milliseconds when milliseconds are 000. ISO 8601 comes in several formats. For example, converting January 23, 2000, 1:23:45.678 (JST; +09:00) to ISO 8601 results in the following:

FormatConversion result
Basic format20000123T012345.678+0900
Extended format2000-01-23T01:23:45.678+09:00

While creating the  Asset object via REST API, use the date and time in Extended Format. Alternatively, If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset.

Cause

Date and time template used for creating asset objects doesn't match with the ISO 8601 Extended format.

Solution

Use the ISO 8601 extended format to create asset objects via Rest API. 

In this case, the correct format is:

2022-04-05T20:59:32.000+02:00

Alternatively, If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset.

For Example:

2022-04-05T20:59:32.000Z


Last modified on May 12, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.