Clarity Service Management

Expand all | Collapse all

[REST API] Updating status

Jump to Best Answer
  • 1.  [REST API] Updating status

    Posted 11-05-2015 12:34 PM

    Hello everyone.

     

    I'm trying to update status of a Ticket using REST. But when a status transition need comment, I receive the message error:

     

         "An activity log comment is required in order to set the status to 'Aberta'."

     

    After insert a comment log using REST and try again, the same errors appears.

     

    Anybody already did that? I tried to check mobile demo and same error occurs.



  • 2.  Re: [REST API] Updating status
    Best Answer

    Posted 11-06-2015 02:17 PM

    It Works


    Just need to add status_comment_f on payload. This going to create a status comment without a custom comment.


    1 - Encrypt the username and password using BASE64 using the format: [username]:[password]

         If your username is: "joe.doe" and your password is "Hello123" encrypt that using this format: "joe.doe:Hello123"

         Tip: You can use a website do encrypt for you if you want to.

         As result, you going to have something like "am9lLmRvZTpIZWxsbzEyMw==". This will be used on Authorization method.


    2 - create a POST Method to make the REST login:

    URI:
    http://[HOSTNAME]:[Port - default is 8050]/caisd-rest/rest_access
    
    Headers:
    Accept: application/json
    Content-Type: application/json; charset=UTF-8
    Authorization: Basic [Login + Password using BASE64 Encrypt]
    
    Payload:
    { "rest_access": null }
    
    
    

     

    You'll receive the session ID to use the other methods.

     

    3 - create a PUT Method to update the ticket as commented below:

    URI:
    http://[HOSTNAME]:[Port - default is 8050]/caisd-rest/cr/[Request ID]
    
    
    Headers:
    X-AccessKey: [Session ID created using rest_acess]
    Accept: application/json
    Content-Type: application/json; charset=UTF-8
    
    
    Payload:
    {
      "cr": {
        "status_comment_f": "1",
        "status": { "@REL_ATTR": "WIP" },
        "last_mod_by": { "@REL_ATTR": "U'************************'" },
        "last_mod_dt": "1446141596"
      }
    }
    
    
    

    Each field detailed:

    status_comment_f: Use 1 to enforce the status comment information

    status: the code of new status

    last_mod_by: the UUID of the contact who update the ticket

    last_mod_dt: actual time using EPOCH format (if you don't know what EPOCH is, check document created by TMACUL)

     

    4 - Create a log comment using POST method:

    URI:
    http://[HOSTNAME]:[PORT - default is 8050]/caisd-rest/alg
    
    
    Headers:
    X-AccessKey: [Session ID created using rest_acess]
    Accept: application/json
    Content-Type: application/json; charset=UTF-8
    
    Payload
    {
      "alg": {
        "analyst": { "@REL_ATTR": "[UUID of Analyst]" },
        "call_req_id": { "@REL_ATTR": "[CR Persistent ID]" },
        "description": "Comment Example",
        "internal": "0",
        "k_tool":"PDM",
        "tenant": { "@REL_ATTR": "'[TENANT UUID]'" },
        "type": { "@REL_ATTR": "LOG" },
        "time_spent": "0"
      }
    }
    
    
    

     

    Hope this help

     

    (Thanks for help Jon_Israel and Chi_Chen)