DX NetOps

 View Only
  • 1.  How to send trouble ticket HTML code via cURL

    Posted Jan 02, 2019 04:28 PM

    Hello,

     

    As you can see below I was able to send trouble ticket as integer or string via REST

     

    curl -k -H -X PUT "Content-type:application/xml" -u "<spec_user>:<pass>" "https://oc_url:8443/spectrum/restful/alarms/5c2a176e-3845-1002-0363-008010b983f9?attr=0x12022&val=TICKETNUMBER"

     

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?><alarm-update-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response"><alarm-responses><alarm error="Success" id="5c2a176e-3845-1002-0363-008010b983f9"><attribute error="Success" id="0x12022"/></alarm></alarm-responses></alarm-update-response-list>

     

    I'm trying to send trouble ticket HTML code with no lucky

     

    curl -k -H -X PUT "Content-type:application/xml" -u "<spec_user>:<pass>" "https://oc_url:8443/spectrum/restful/alarms/5c2a176e-3845-1002-0363-008010b983f9?"attr=0x12022&val=<html><a href=http://servicedesk.com=$TICKETNUMBER>$TICKETNUMBER</a></html>

     

     

    Thanks in advance,

    Márcio Moreno



  • 2.  Re: How to send trouble ticket HTML code via cURL

    Broadcom Employee
    Posted Jan 02, 2019 05:57 PM

    I haven't tried this with REST yet but when I use the updatealarm command, I have to include quotes in the href around the URL:

     

    TICKETID=$SANM_0x12022

    TICKETID="<html><a href=\"http://a.b.com/t.do?sysparm_query=number%3D$TICKETID\">$TICKETID</a></html>"

     

    ./updatealarm $MHANDLE $AID 0x12022 "$TICKETID"

     

    Otherwise, it's not valid HTML.

     

    -Rob



  • 3.  Re: How to send trouble ticket HTML code via cURL

    Posted Jan 02, 2019 06:12 PM

    Hi Rob,

      

    I put HTML code between quotes too, however it doesn't work. Also tried escaping special chars

     

    <!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
            org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:463)
            org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:298)
            org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
            org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
            org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1385)
            org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
            java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
            java.lang.Thread.run(Thread.java:748)
    </pre><p><b>Note</b> The fu


  • 4.  Re: How to send trouble ticket HTML code via cURL

    Posted Jan 04, 2019 10:40 AM

    Hi!
    Is you're goal to make a clickable url in specturm for the trouble ticket id field?
    Then you can put the static part of the url into oneclick Preferences under Alarms tab and trouble ticket url.
    Then you just need to put the integer value into the attribute. Oneclick build the rest of the url.
    This works for us.
    Regards
    Bjørn