Introduction

These JSON examples of the request/response APIs are based on the following Client scenario:

  • CLIENT Name – PRISTINE PARTS (fictitious client)
  • This CLIENT uses the Case API channel, with these credentials provided to Juniper during onboarding:
    • accountID101412170
    • userID - johnsmith@pristineparts.com
    • appId (provided by Juniper): cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5
    • customerSourceID (Juniper and Client determination): pristineparts-partner

createSR

Example 1: createSR Request/Response Success Scenario

This example shows a payload on the createSR request that has no validation errors.

{
  "createSRRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime" : "2019-06-04T18:49:45.000Z",
    "caseInformation" : {
      "caseTypeCode" : "TEC",
      "customerCaseNumber" : "PP1000",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "2g4liajj2o9v46lcib6vnuz7tukwqwozsmuph5x4",
      "addSenderToEmail" : true,
      "ccEmail" : "joe@pristineparts.com",
      "followUpMethod" : "Full",
      "networkOutage" : false,
      "synopsis" : "FEC errors on port of QFX device",
      "priority" : "P3 - Medium",
      "problemDescription" : "Large number of errors on 1/0/10. Moved SFP to another port. Issue went away. Please analyze issue with FPC"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com",
      "preferredTelephoneCountryCode" : "US",
      "preferredTelephoneNumber" : "8889991234",
      "preferredTelephoneExtension" : "1234"
    },
    "product" : {
      "serialNumber" : "XY123",
      "routerName" : "sjc.sw12"
    }
  }
}
HTTP status code - 200
{
    "createSRResponse": {
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request",
        "responseDateTime": "2019-06-04T18:49:52.000Z",
        "serviceRequestNumber": null,
        "customerCaseNumber": "PP1000",
        "customerUniqueTransactionID": "2g4liajj2o9v46lcib6vnuz7tukwqwozsmuph5x4"
    }
}

Example 2: createSR Request/Response Error Scenario

This example shows payload on the createSR request that fails validation.

{
  "createSRRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "TEST@TTT.COM",
    "requestDateTime" : "2019-06-04T19:49:45.000Z",
    "caseInformation" : {
      "caseTypeCode" : "ADM",
      "customerCaseNumber" : "",
      "customerSourceID" : "pristine",
      "customerUniqueTransactionID" : "2g4liajj2o9v46lcib6vnuz7tukwqwozsmuph5x8",
      "addSenderToEmail" : true,
      "followUpMethod" : "Ful",
      "synopsis" : "Need update on a Sales Order",
      "priority" : "P3 - Medium",
      "adminSRType" : "Sales Inquiry",
      "adminSRSubType" : "Order Status",
      "problemDescription" : "Kindly expedite delivery of Sales Order PP12345678"
    },
    "contact" : {
      "accountID" : "100165575",
      "contactEmail" : "TEST@TTT.COM",
      "preferredTelephoneCountryCode" : "US",
      "preferredTelephoneNumber" : "8889991234",
      "preferredTelephoneExtension" : "123"
    }
  }
}
HTTP status code - 400
{
    "createSRResponse": {
        "statusCode": "400",
        "status": "Error",
        "message": "Error in processing the request",
        "responseDateTime": "2019-06-14T19:49:52.015Z",
        "serviceRequestNumber": null,
        "customerCaseNumber": null,
        "customerUniqueTransactionID": "2g4liajj2o9v46lcib6vnuz7tukwqwozsmuph5x8",
        "fault": [
            {
                "errorClass": "Validation",
                "errorType": "Error",
                "errorCode": "905",
                "errorMessage": "Mandatory key – customerCaseNumber - is not provided"
            },
            {
                "errorClass": "Validation",
                "errorType": "Error",
                "errorCode": "907",
                "errorMessage": "appID and customerSourceID combination is not valid"
            },
            {
                "errorClass": "Validation",
                "errorType": "Error",
                "errorCode": "910",
                "errorMessage": "Invalid followupMethod value"
            }
        ]
    }
  }

updateSR

Example 1 – updateSR Request/Response Success Scenario

This example shows a payload on the updateSR request without validation errors. Any JSON keys without a value are ignored. The purpose of the update is to request a change in SR priority and add a note.

Note: Since the ccEmail, followupMethod, synopsis, problemdescription, specialRelease, and routerName fields are blank, they are ignored.

{
  "updateSRRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime" : "2019-06-10T21:30:59.160Z",
    "caseInformation" : {
      "customerCaseNumber" : "",
      "serviceRequestNumber" : "2019-0523-T-0011",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "7b1a5240-ccc5-489c-b75e-25c7cf9c1327",
      "addSenderToEmail" : true,
      "ccEmail" : " ",
      "followUpMethod" : " ",
      "synopsis" : " ",
      "priority" : "P2 - High",
      "problemDescription" : " "
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"
    },
    "product" : {
      "specialRelease" : " ",
      "routerName" : " "
    },
    "notes" : {
      "noteTitle" : " ",
      "content" : "The issue is now occurring periodically. Previous requested information has been captured again and will be uploaded. Due to the nature of impact we are requesting priority to be changed to a P2."
    }
  }
}
HTTP status code - 200
{
    "updateSRResponse": {
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request",
        "responseDateTime": "2019-06-10T21:31:03.160Z ",
        "serviceRequestNumber": "2019-0523-T-0011",
        "customerCaseNumber": null,
        "customerUniqueTransactionID": "7b1a5240-ccc5-489c-b75e-25c7cf9c1327"
    }
}

querySR

Example – querySR Request/Response Success Scenario

This is an example payload of a querySR without validation errors.

SR 2019-0611-T-0011 was created by Frank Jackson from Pristine Parts. John Smith is the JTAC owner of the SR.

This example shows an SR with an RMA, linked KB and PR articles, and some notes.

{
  "querySRRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime" : "2019-07-02T09:49:45.000Z",
    "caseInformation" : {
      "customerCaseNumber" : "PP1000",
      "serviceRequestNumber" : "2019-0611-T-0011",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "2e4liajj2o9v46lcib6vnuz7tukwqwozsmuph5y9"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"
    }
  }
}
HTTP status code - 200
{
    "querySRResponse": {
        "customerCaseNumber": "PP1000",
        "customerSourceID": "pristineparts-partner",
        "customerUniqueTransactionID": "2e4liajj2o9v46lcib6vnuz7tukwqwozsmuph5y9",
        "serviceRequestNumber": "2019-0611-T-0011",
        "responseDateTime": "2019-07-15T23:39:33.781Z",
        "statusCode": "200",
        "status": "Success",
     "message": "Successfully processed the request",
        "caseType": {
            "caseTypeCode": "TEC",
            "caseTypeDescription": "Technical Service Request"
        },
        "synopsis": "FEC errors on a port of EX device.",
        "problemDescription": "Large number of errors on 1/0/10. Moved SFP to another port. Issue went away. Please analyze issue.",
        "srStatus": "Open",
        "priority": "P3 - Medium",
        "adminSRType": null,
        "adminSRSubType": null,
        "ccEmail": null,
        "addSenderToEmail": false,
        "followUpMethod": "Email Full Text Update",
        "contact": {
            "accountID": "101412170",
            "accountName": "PRISTINE PARTS",
            "contactName": "Frank Jackson",
            "contactEmail": "frank@pristineparts.com",
            "preferredTelephoneCountryCode": "DZ",
            "preferredTelephoneNumber": "2134567",
            "preferredTelephoneExtension": null
        },
        "rma": [
            {
                "rmaNumber": "R200165423",
                "items": [
                    {
                        "itemNumber": "100",
                        "itemType": "RMA Defective",
                        "itemStatus": "RMA in Process"
                    }
                ]
            }
        ],
        "product": {
            "serialNumber": "CABM5577",
            "productID": "EX9200-SF",
            "productSeries": "EX-Series",
            "platform": "EX9204",
            "version": "R3-S2",
            "release": "16.1",
            "software": null,
            "specialRelease": null,
            "routerName": "SJC.SW12"
        },
        "escalate": [
            {
                "description": "Faster RMA Progress",
                "dateTime": "2019-07-12T16:47:45.000Z",
                "escalatedBy": "Frank Jackson",
                "status": "Dispatch"
            }
        ],
        "notes": [
            {
                "id": "005056A30FB01EE9A397264988F4D079-20190715182604182-ZSTS",
                "description": "Current Status",
                "title": null,
                "originator": "John Smith",
                "dateTime": "2019-07-15T18:26:02.000Z"
            },
            {
                "id": "005056A30FB01EE9A397264988F4D079-20190715182410236-Z011",
                "description": "Customer Notes",
                "title": null,
                "originator": "John Smith",
                "dateTime": "2019-07-15T18:24:05.000Z"
            },
            {
                "id": "005056A30FB01EE9A397264988F4D079-20190715174356728-Z011",
                "description": "Customer Notes",
                "title": null,
                "originator": "John Smith",
                "dateTime": "2019-07-15T17:43:55.000Z"
            },
            {
                "id": "005056A30FB01EE9A397264988F4D079--S001",
                "description": "Problem Description",
                "title": "PD on SJC.SW12",
                "originator": "Frank Jackson",
                "dateTime": "2019-06-12T02:24:26.000Z"
            }
        ],
        "linkedReferences": [
            {
                "url": "https://kb.juniper.net/KB16275",
                "referenceId": "KB16275",
                "referenceType": "KB"
            },
            {
                "url": "https://prsearch.juniper.net/PR1418048",
                "referenceId": "PR1418048",
                "referenceType": "PR"
            }
        ],
        "recentNotes": [
            {
                "id": "005056A30FB01EE9A397264988F4D079-20190715182604182-ZSTS",
                "dateTime": "2019-07-15T18:26:02.000Z",
                "originator": "John Smith",
                "content": "Current Status:\n\nAwaiting output of some cli commands to ascertain if issue is due to a hardware fault on the FPC\n\nJohn Smith\n"
            },
            {
                "id": "005056A30FB01EE9A397264988F4D079-20190715182410236-Z011",
                "dateTime": "2019-07-15T18:24:05.000Z",
                "originator": "John Smith",
                "content": "Kindly provide output of the following commands to help determine if issue is due to a hardware fault on the port.\n\nshow request support information\nshow pfe statistics traffic\n\nJohn Smith\n\n"
            },
            {
                "id": "005056A30FB01EE9A397264988F4D079-20190715174356728-Z011",
                "dateTime": "2019-07-15T17:43:55.000Z",
                "originator": "John Smith",
                "content": "I from the JTAC team supporting the EX Series product line.\n\nI have taken ownership of this Service Request. I am looking into the issue details and information provided and will get to you shortly.\n\nJohn Smith"
            }
        ]
    }
}

queryNote

Example – queryNote Request/Response Success Scenario

CLIENT did first a querySR request against 2019-0611-T-0011 and then decided to get the note content associated with a particular noteId provided in the notes array.

This is an example queryNote API request/response for a noteId of 005056A30FB01EE9A397264988F4D079-20190720233401265-Z011 in SR 2019-0611-T-0011.

{
  "querySRNoteRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime" : "2019-07-22T11:54:57.927Z",
    "caseInformation" : {
      "customerCaseNumber" : "PP1000",
      "serviceRequestNumber" : "2019-0611-T-0011",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "fde844c7-8a0e-50a3-af9d-456bb721g8c7",
      "noteId" : "005056A30FB01EE9A397264988F4D079-20190720233401265-Z011"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "joe@pristineparts.com"
    }
  }
}
HTTP status code - 200
{
    "querySRNoteResponse": {
        "customerCaseNumber": null,
        "customerSourceID": "pristineparts-partner",
        "customerUniqueTransactionID": "fde844c7-8a0e-50a3-af9d-456bb721g8c7",
        "serviceRequestNumber": "2019-0611-T-0011",
        "responseDateTime": "2019-07-22T18:55:31.153Z",
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request",
        "id": "005056A30FB01EE9A397264988F4D079-20190720233401265-Z011",
        "dateTime": "2019-07-20T23:33:23.000Z",
        "content": "Thank you for the various cli command outputs and for the contact and address to which a replacement part needs to be sent in the event it is a hardware issue. I have analyzed the issue and it is indeed a hardware issue. RMA R200165423 has been created. You will receive notifications from Juniper Logistics team as the RMA is processed.\n\nJohn Smith\n"
      }
    }
}

queryRMA

Example – queryRMA Request/Response Success Scenario

This is an example payload of a queryRMA request without validation errors.

SR 2017-0831-T-0708 was created by Frank Jackson. It has two RMAs created by JTAC case owner. This queryRMA is against RMA R200142229 associated with this SR.

{
  "queryRMARequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime" : "2019-06-13T12:14:57.927Z",
    "caseInformation" : {
      "customerCaseNumber" : "",
      "serviceRequestNumber" : "2017-0831-T-0708",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "7c1836ea-e1f1-49a8-97fc-4bc5945bb592",
      "rmaNumber" : "R200142229"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"

    }
  }
}
HTTP status code - 200
{
    "queryRMAResponse": {
        "customerCaseNumber": null,
        "customerSourceID": "pristineparts-partner",
        "customerUniqueTransactionID": "7c1836ea-e1f1-49a8-97fc-4bc5945bb592",
        "serviceRequestNumber": "2017-0831-T-0708",
        "responseDateTime": "2019-07-12T18:01:52.754Z",
        "rmaNumber": "R200142229",
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request",
        "rmaContact": {
            "companyName": "PRISTINE PARTS",
            "contactName": "dylan lusk",
            "contactEmail": "dlusk@pristineparts.com",
            "telephoneCountryCode": "US",
            "telephoneNumber": "925 348 0190",
            "address": {
                "address1": "3039 Cornwallis Rd",
                "address2": null,
                "city": "Research Triangle Park",
                "stateCode": "NC",
                "state": "North Carolina",
                "countryCode": "US",
                "country": "USA",
                "postalCode": "27709-0154"
            }
        },
        "defectiveItems": [
            {
                "itemNumber": "100",
                "dateTime": "2017-09-01T17:32:24.000Z",
                "productID": "RE-S-1800X4-16G-BB",
                "serialNumber": "9009135239",
                "trackingNumber": "1Z7AF3889034094251",
                "carrierDescription": null,
                "receivedDate": "2017:09:12T17:37:30.000Z",
                "defectiveItemStatus": "Request Satisfied - Closed"
            }
        ],
        "replacementItems": [
            {
                "itemNumber": "120",
                "defectiveItemNumber": "100",
                "productID": "RE-S-1800X4-16G-S",
                "serialNumber": "9009127078",
                "carrierDescription": null,
                "shipDate": "2017-09-02T01:07:14.000Z",
                "shipmentServiceLevel": "NEXT-BUSINESS DLVY ADV REP W/ONSITE TECH",
                "trackingNumber": "1Z7AF3880134094249",
                "replacementStatus": "RMA Delivered - Closed",
                "receivedDate": "2017-09-05-T12:57:00.000Z",
                "receivedBy": "MITCHELL"
            }
        ],
        "ceItems": [
            {
                "defectiveItemNumber": "100",
                "productID": "CEONSITE",
                "engineerStatus": "CE Not Required",
                "vendorName": null,
                "vendorPhone": "1234567",
                "serviceRequestedDate": null,
                "actualServicedDate": null,
                "contactedDate": null,
                "estimatedArrivalDate": null
            }
        ]
    }
}

escalateSR

Example – escalateSR Request/Response Success Scenario

This is an example of using this API to request SR reassignment to any available engineer in any time zone because the current JTAC owner has an OOO message and there is a service outage on the router.

{
   "escalateSRRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime" : "2019-07-23T15:15:45.000Z",
    "caseInformation" : {
      "customerCaseNumber" : "PP2000",
      "serviceRequestNumber" : "2019-0722-T-0004",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "b16fb84f-e95e-458f-8493-b1b2b7866c36"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"

    },
    "escalationInformation" : {
      "code" : "62",
      "additionalEmail" : "joe@pristineparts.com",
      "telephoneCountryCode" : "US",
      "telephoneNumber" : "9967876543",
      "telephoneExtension" : "1234"
    },
    "notes" : {
      "noteTitle" : "Service Outage on Router sjc.sw12",
      "content" : "Current SR owner seems to be OOO. Please reassign immediately since we have a service outage on the router."
    }
  }
}
HTTP status code - 200
{
    "escalateSRResponse": {
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request",
        "responseDateTime": "2019-07-23T22:36:26.707Z",
        "serviceRequestNumber": "2019-0722-T-0004",
        "customerCaseNumber": "PP2000",
        "customerUniqueTransactionID": "b16fb84f-e95e-458f-8493-b1b2b7866c36"
    }
}

closeSR

Example – closeSR Request/Response Success Scenario

This is an example client request to close an SR after issue resolution, canceling the need of assistance from Juniper Support. If the SR is in a Dispatch status, the SR will be automatically taken to Closed Status otherwise the SR Status moves to Pending Closure and the SR owner will do the needful to close the SR.

{
  "closeSRRequest": {
    "appId": "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId" : "johnsmith@pristineparts.com",
    "requestDateTime": "2019-07-23T15:39:59.515Z",
    "caseInformation": {
      "customerCaseNumber": "PP3000",
      "serviceRequestNumber": "2019-0722-T-0005",
      "customerSourceID": " pristineparts-partner ",
      "customerUniqueTransactionID": "4b1b9995-b8d6-49f2-9f35-4daea07a66c0"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"

    },
    "notes": {
      "noteTitle": "",
      "content": "Please Close this SR. Issue resolved. No assistance required"
    }
  }
}
HTTP status code - 200
{
  "closeSRResponse": {
    "responseDateTime": "2019-07-23T22:47:40.411Z",
    "serviceRequestNumber": "2019-0722-T-0005",
    "customerCaseNumber": "PP3000",
    "customerUniqueTransactionID": "4b1b9995-b8d6-49f2-9f35-4daea07a66c0",
    "message": "Successfully processed the request",
    "statusCode": "200",
    "status": "Success"
  }
}

Attaching Files to an SR

The attach file process has three steps.

Step 1: Request a token to use with AWS S3 SDK to upload one or more files.

API Request — getfileuploadtoken

{
  "fileUploadTokenRequest": {
    "appId": "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId": "johnsmith@pristineparts.com",
    "requestDateTime": "2019-07-23T15:03:33.850Z",
    "caseInformation": {
      "serviceRequestNumber": "2019-0722-T-0004",
      "customerSourceID": "pristineparts-partner",
      "customerUniqueTransactionID":"ndgkqnca1yr9x3hzud9sy9mrbbikbo80gbvn05xc"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"

    },
  }
}

Response

{
    "fileUploadTokenResponse": {
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request",
        "responseDateTime": "2019-07-23T22:06:02.772Z",
        "serviceRequestNumber": "2019-0722-T-0004",
        "customerCaseNumber": null,
        "customerUniqueTransactionID": "ndgkqnca1yr9x3hzud9sy9mrbbikbo80gbvn05xc",
        "stsToken": {
            "accessKey": "ASIATS54L2WL6EOYNXI4",
            "secret": "gjRbvGNCvHhPOjZBbMH1VQ/DP7u87Hf8h05ygYZq",
            "sessionToken": "FQoGZXIvYXdzEIj//////////wEaDN80kj94RjFjVkzViyKpA7bXl543wZneK6Apkw5FN0UrI0Qbd1q4llDB++2ap7QStsnys+hG7RUpdY2Ux3Frud9KXGPr35reylS8ye+HGQoRGNjLur9IIj4aReqWwP5Nhhj8DA7gyn7lFJhWoXpTYU4H3hE7SNPm971a5SlL2xzmRK+Z73up3erIk7GlQM670IqlJ0C9h9MOb+fnpQAoGdgB3vVIVaeKGA8RBRYWpeR4Pfgoo2CwQxBdOyU99zYUKMaQBHUW2T7zrUAyB/pBjkpfe3fr4UFBuPsQcRKZGO9wqxNGWUVeDHd/caIeKUO0NXSZqlFMzPLUT0KWopnfCXTun7vAyu4d5zJNwLYryXJjuoxyDxPVmrYD2bAKFoznZVmmNgNlzX5IgFENqNku2/OlgTMKYa5WHFENWcIcR98ctA1dA2eN074+k9uOgS0FoA2gflVfLa88Z938c8fhjEiOXojfij5K2RdlTPWQlEqRIbM2GolczXNzDa3t/8ouS6TsRnn0smPhdjuEkZ+seipQ5z5s4Nv0G68m2rDGwYaIKLuS428zZH7ApRBsEOOb76DhEsgQt7V/KMqJ3ukF",
            "bucketName": "jnpr-it-stage-case-attachments",
            "path": "archive/attachments/OETCLR/2019/07/22/T/0004/",
            "region": "us-west-2"
        }
    }
}

Note - stsToken will expire in one hour. Additionally the stsToken:sessionToken is valid only for the serviceRequestNumber requested.

Step 2: Use AWS S3 SDK to Upload the Files

Below is a code snippet on how to upload a file to AWS S3 in Java Language.

Specific considerations to be made are as follows:

  • At the path that the file is being uploaded if there exists one with the same filename, AWS S3 will overwrite the file. To permit multiple files with same filename at the same path, the filename must be randomized.

  • For the file to be identified and processed properly in AWS S3, the below metadata MUST to be set on the AWS upload request before triggering the upload process. This aspect is typically missed leading to the file not getting uploaded to AWS S3 and hence is being called out.

Key Value
uploadedby SR-API
original-file-name URL encoded file name being uploaded.

Example code snippet (in Java language) for small file uploads. In this example the file being uploaded is mx960rsi.txt


InputStream fileInputStream=null;
AmazonS3 s3Client=null;
try{
    String fileName = "mx960rsi.txt";

    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
    Date date = new Date();
    Random rand = new Random();

    // randomizing the file name as AWS S3 overwrites the file with same name at the same path
    String s3filePath = "path from stsToken obtained in step 1 response" + sdf.format(date) + (rand.nextInt(1000) + 1000);

    BasicSessionCredentials basicSessionCredentials = new BasicSessionCredentials(accessKey, secret, sessionToken);
    s3Client = AmazonS3ClientBuilder.standard()
               .withCredentials(new AWSStaticCredentialsProvider(basicSessionCredentials))
               .withRegion(region)
               .build();

    // setting up the required metadata
    Map<String, String> userMetadata = new HashMap<String, String>();
    userMetadata.put("uploadedby", "SR-API");
    userMetadata.put("original-file-name", SdkHttpUtils.urlEncode(fileName, false));
    ObjectMetadata metadata = new ObjectMetadata();
    metadata.setUserMetadata(userMetadata);

    // Preparing the fileInputStream variable for the AWS S3 call
    fileInputStream = new ByteArrayInputStream(FileUtils.readFileToByteArray(new File(fileName)));

    // In this example, for small files, using the AWS S3 PuObjectRequest to upload file to Juniper AWS S3 bucket.

    PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, s3filePath, fileInputStream, metadata);
    s3Client.putObject(putObjectRequest);

}catch(Exception ex){
    ex.printStackTrace();
}finally{
    if(fileInputStream!=null){
        fileInputStream.close();
    }
    if(s3Client!=null){
        s3Client.shutdown();
    }
}

For large files, refer to the AWS S3 SDK documentation on leveraging multipart uploads to speed the upload process.

References:

Step 3: After successful upload of one or more files using the token, call attachFileDetailsRequest

Call the attachFileDetailsRequest API to link the files to the SR. This example is to link to the SR three files that were uploaded in Step 2 using the token.

Note:

  • title: is the name that will be displayed in our self service portals and what the case owner would see. While it can be the same as the original-file-name, it doesn't have to be as illustrated in the example.
  • documentPath: is a concatenation of 'path provided in the stsToken and used in Step 2' and 'the randomized filename used in Step 2'. In this example said path is archive/attachments/OETCLR/2019/07/22/T/0004

API Request — attachfile

{
  "attachFileDetailsRequest" : {
    "appId" : "cCMUrMyyJUcOWxNBkmwDX11GU2nY2mlF3i15hIE5",
    "userId": "johnsmith@pristineparts.com",   
    "requestDateTime" : "2019-08-14T16:31:15.927Z",
    "caseInformation" : {
      "customerCaseNumber" : "PP2000",
      "serviceRequestNumber" : "2019-0722-T-0004",
      "customerSourceID" : "pristineparts-partner",
      "customerUniqueTransactionID" : "fde864c7-8a0e-49a3-af9d-456bb721g9d7"
    },
    "contact" : {
      "accountID" : "101412170",
      "contactEmail" : "frank@pristineparts.com"

    },
    "attachment" : [ {
      "title" : "mx960rsi.txt",
      "type" : "RSI",
      "sizeInBytes" : "100",
      "documentPath" : "archive/attachments/OETCLR/2019/07/22/T/0004/201908141630450101456",
      "uploadedDateTime" : "2019-08-14T16:30:45.010Z"
    },
    {
      "title" : "Log messages mx 960 router",
      "type" : "LOG",
      "sizeInBytes" : "10000",
      "documentPath" : "archive/attachments/OETCLR/2019/07/22/T/0004/201908141630500002645",
      "uploadedDateTime" : "2019-08-14T16:30:50.000Z"
    },
    {
      "title" : "networktopology.txt",
      "type" : "DOCUMENT",
      "sizeInBytes" : "300",
      "documentPath" : "archive/attachments/OETCLR/2019/07/22/T/0004/201908141631103003546",
      "uploadedDateTime" : "2019-08-14T16:31:10.300Z"
    } ]
  }
}

Response

{
    "attachFileDetailsResponse": {
        "customerCaseNumber": "PP2000",
        "customerSourceID": "pristineparts-partner ",
        "customerUniqueTransactionID": "fde864c7-8a0e-49a3-af9d-456bb721g9d7",
        "serviceRequestNumber": "2019-0722-T-0004",
        "responseDateTime": "2019-08-14T16:31:25.927Z",
        "statusCode": "200",
        "status": "Success",
        "message": "Successfully processed the request"
    }
}

publishSR

This example publishSR is sent to the CLIENT endpoint on successful creation of an SR in response to a createSR API request.

Using the customerSourceID, customerCaseNumber and accountID, the CLIENT is expected to match this to the createSR request.

{
  "srDetails": {
    "customerCaseNumber": "PP2000",
    "serviceRequestNumber": "2019-1125-T-2293",
    "customerSourceID": "pristineparts-partner",
    "junUniqueTransactionID": "15747190868349vrz916dajo",
    "transactionDateTime": "2019-11-25T21:58:06.861Z",
    "synopsis": "MX multicast traffic stops forwarding to final subscriber",
    "problemDescription": "Sometimes MX multicast traffic stops forwarding to final subscriber. We can't figure out the reason why multicast is stopped to thesubscribers even though there are always IGMP Request from the subscribers.\\n\\nKindly assist in determining root cause.\\n\\nPlease see files that I will upload shortly providing various information from the router.\\n\\nFrank",
    "srStatus": "Open",
    "priority": "P3 - Medium",
    "adminSRType": null,
    "adminSRSubType": null,
    "ccEmail": "JOE@PRISTINEPARTS.COM",
    "addSenderToEmail": false,
    "followUpMethod": "Email Full Text Update",
    "srOwnerFullName": null,
    "srOwnerEmailAddress": null,
    "status": "Success",
    "statusCode": "200",
    "message": "Successfully processed the request",
    "caseType": {
      "code": "TEC",
      "description": "Technical Service Request"
    },
    "contact": {
      "accountID": "0101412170",
      "accountName": "PRISTINE PARTS",
      "contactName": "FRANK CASTILLO",
      "contactEmail": "FRANK@PRISTINEPARTS.COM",
      "preferredTelephoneCountryCode": "US",
      "preferredTelephoneNumber": "8889991000",
      "preferredTelephoneExtension": "1234"
    },
    "product": {
      "serialNumber": "JN1228B04AFB",
      "productID": "MX480BASE-AC",
      "productSeries": "MX-Series",
      "platform": "MX480",
      "version": null,
      "release": null,
      "software": null,
      "specialRelease": null,
      "routerName": "SJC.MXROUTER"
    },
    "notes": [
      {
        "id": "005056A372431EEA83F9D0394A0A7C96--S001",
        "description": "Problem Description",
        "title": "Sometimes MX multicast traffic stops forwarding to final subscriber. We can't figure out the reason why multicast is stopped to thesubscribers even though there are always IGMP Request from the subscr",
        "originator": "FRANK CASTILLO",
        "dateTime": "2019-11-25T21:57:01.000Z"
      }
    ]
  }
}