This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

REST API for Create Change , how to add Target start and end time/ Planned start and end time?

Hello All,

I am trying to add new change request via REST API to MFSM.

API I am using is -

http://<IP>:13083/SM/9/rest/changes, POST

Parameters passed are:

        

{
"Change": {

        
        "Service": < string > ,
        "description.structure": {
        "Description": ["test disc"]
                    },
        "header": {
                "AssignmentGroup": < string > ,
                "Category": "Standard Change",
                "ChangeModel": "Standard Change",
                "ChangeCoordinator": "pallavi",
                "InitiatedBy": "pallavi",
                "PlannedEnd": "2022-08-30T10:17:47+00:00",
                "PlannedStart": "2022-08-30T10:17:41+00:00",
                "Reason": < string > ,
                "Subcategory": < string > ,
                "Title": < string >
                }
        }
}

On GUI I can see Target start and Target end date, in API I am adding planned start and planned end date.

Can anyone suggest a proper format of this dates? what is the relation that is accepted between start and end date?  i

If I hard code these dates , request works, but I need it dynamic, so we can accept current date and time.

Please help to find a proper date formats for these API date-time stamp.

  • Suggested Answer

    Hello,

    Datetime fields must use ISO standard formats.
    If you want to specify a time zone, you need to add the time zone with following format:
    yyyy-MM-ddTHH:mm:ss+hh:mm
    For example: 2019-11-24T18:00:00+01:00

    Thanks

  • Thank you for suggesting this  

    Do we have any relation between start and end time? end time should be 1 hour big than start like that?

    I am adding time format correctly, but it sometimes throws error.

    How much should be the ideal difference between start and end time?

  • Hello,

    end time should not be equal or less than the start time.

    I have tested using the client and 1 second is enough.

    Thanks

  • Suggested Answer

    Hello,

    Tested using REST.

    example of the json:

    {
    "Change": {

            
            "Service""CI1001020" ,
            "description.structure": {
            "Description": ["test disc"]
                        },
            "RequestedEndDate""2023-08-30T10:17:47+00:00",
            "Impact"2,
            "Urgency"2,
            "header": {
                    "Category""Standard Change",
                    "ChangeModel""Normal Major RFC",
                    "ChangeCoordinator""Admin.General",
                    "InitiatedBy""FALCON, JENNIFER",
                    "PlannedEnd": "2024-08-30T10:17:42+00:00",
                    "PlannedStart": "2024-08-30T10:17:41+00:00",
                    "Reason""user" ,
                    "Subcategory": < string > ,
                    "Title": < string >
                    }
            }
    }
    result in Service Manager:
    >d $L.file
    cm3r={[{["C10072", 2, 1, "Standard Change", "initial", "approved", "FALCON, JENNIFER", , , , , , , , "Admin.General", , , , '08/30/24 04:17:41', , , '08/30/24 04:17:42', "user", , "Registration and Categorization", , , , "2", , '02/16/23 06:12:50', "falcon", , true, {}, {}, {}, , '02/16/23 06:12:50', "falcon", , , , , , , , , , , , , , , "< string >", "< string >", "C10072", , , , , , , , {}, {}, "Normal Major RFC"]}, {[{"test disc"}, {}, {}, {}, {}, {}, {}]}, {[{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]}, {[, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , {}, {}, {}, , , , , , , {}, {}, , {}, , , , , , , , , , , {{[, , , , , , ]}}, {}, , , , , , , , , , , , , , {}, , , , "", , {}, {}, , , , , , {}]}, {[, , {}]}, {{[, , , ]}}, {{[, , , , ]}}, 0, "falcon", '02/16/23 06:12:50', , , "2", "2", {}, , , , {}, "CI1001020", , '08/30/23 04:17:47', , , {}, {}, {[, , , , , ]}, {}, , , {[, , , , "noauto", , ]}, {}, , , {}, , {}, {}, {}, {}, , 2, , , , {}, , , , , , , {[, ]}]}
    >d planned.start in $L.file
    08/30/24 04:17:41
    >d planned.end in $L.file
    08/30/24 04:17:42
    Thanks
  • Verified Answer

    Somehow I was not able to add in this format , so I tried this and its working.

    2023-02-16T09:07:24.481Z