Symptom
- This article addresses a common issue encountered when submitting a POST request to the Case Management service.
- Specifically, it provides guidance on resolving
DateTimeParseException
errors caused by incorrect date formats in thereportedOn
field. - This error occurs when the
reportedOn
field in the JSON payload contains a date and time string that does not comply with the expected format.
Environment
- SAP Service Cloud Version 2 1.0
- SAP Sales Cloud Version 2 1.0
Cause
- The
java.time.Instant
class, which is used to parse date and time strings in the backend, expects the date to be in a specific format (ISO 8601). - The error is triggered if the string includes an unrecognized format, such as a timezone offset with milliseconds.
Resolution
- To resolve this issue, the
reportedOn
field must be formatted correctly. - There are two possible options options. Below are steps to format the date and time string in the JSON payload.
- Use UTC Format: The recommended approach is to use the UTC format for the
reportedOn
field.- Ensure the timestamp ends with a 'Z' to denote UTC time.
- Example: "reportedOn": "2024-08-13T09:14:51.842Z"
- Simplified Date Format (if applicable): If milliseconds are not necessary, you may omit them and provide a simpler date and time format.
- This format should be accepted by the server.
- Example: "reportedOn": "2024-08-13T09:14:51+00:00"
- Use UTC Format: The recommended approach is to use the UTC format for the
- Administrators can perform the above using tools like Insomnia, Postman or the API Business Accelerator Hub
- Steps to Resolve the Issue in Insomnia:
- Open Insomnia:
- Launch Insomnia and open the workspace where you are managing your API requests.
- You can use Basic Authentication to connect to the webservice
- The same test can be executed at https://api.sap.com/api/SalesSvcCloudV2_case/overview
- Create or Open the POST Request:
- If you already have a POST request created for the Case Management service, open it.
- Otherwise, create a new request by clicking on the
+
icon and selectingNew Request
. - Name your request (e.g., "Create Case Request") and choose the
POST
method.
- Enter the Request URL:
- In the URL field, enter the endpoint for the Case Management service:
- For example, https://yourinstance.XXX.crm.cloud.sap/sap/c4c/odata/v1/case-service/cases
- Where XXX is also part of your tenant URL
- Set Up the JSON Body:
- Click on the
Body
tab. - Select the
JSON
option from the dropdown menu. - Paste the JSON payload in the body, ensuring the
reportedOn
field is correctly formatted.
Example (replace the variables according to your needs and add any additional fields which are mandatory):
{
"subject": "Complaint",
"priority": "01",
"caseType": "CASE_TYPE",
"statusSchema": "STATUS_SCHEMA",
"status": "STATUS_CODE",
"timePoints": {
"reportedOn": "2024-08-13T09:14:51.842Z" //or use "reportedOn": "2024-08-13T09:14:51+03:00" but not both.
},
"individualCustomer": {
"id": "12345678-1234-1234-1234-123456789012"
}
}
- Click on the
- Open Insomnia:
- Steps to Resolve the Issue in Insomnia:
Keywords
DateTimeParseException, Case Management, POST Request, Insomnia, Java Time Instant, ISO 8601 Format, Timestamp Format, Bad Request Error, reportedOn Field, JSON Parse Error, API Troubleshooting, CRM Cloud, Time Zone Offset, UTC Format, Error Resolution, SAP C4C, Service Cloud V2, API Call , KBA , CEC-CRM-CAS , Case Management for SAP Sales/Service Cloud , Problem
Product
SAP Sales Cloud and SAP Service Cloud Version 2 1.0