Need help with the Get and Save attachment api's. I got something but not what I needed.

Trying to understand the attachments rest api.

I am currently using the rest api to create instances from one Cherwell instance to another.
I want to include the attachments.

I am testing the following using swagger and have questions.

On my cherwell instance I am gathering the attachment information using: Get attachments by Business Object name and record ID

I am doing this with one attachment to get it to work but later I guess I will need to use a collection?

Testing this I see the Request URL. Using a one step I will create this Link?
csmweb2t.isd.lacounty.gov/.../Imported

Getting this Response Body... I was thinking that I only need the "Get File" from the Response Body and I would use that to build my request. For example the "Get File" will be the "url": "string"?

The Response:
{
"attachments": [
{
"attachedBusObId": "",
"attachedBusObRecId": "",
"attachmentFileId": "94510b89f88fdb243f5dd34dcba4d87a037873cfcf",
"attachmentFileName": "C:\\Users\\e406702\\Desktop\\test2.txt",
"attachmentFileType": "txt",
"attachmentId": "94510b89f346a7b9fd3c4c40f697ced4e361df75ee",
"attachmentType": 0,
"busObId": "9437f7ea070b26bebb78c74d1cb34b16dd3ea58995",
"busObRecId": "94510b843b2071c278a22042858cd6da41a01da50c",
"comment": "",
"created": "2019-08-15T10:30:51",
"displayText": "test2.txt",
"links": [
{
"name": "Remove",
"url": "http://csmweb2t.isd.lacounty.gov/CherwellAPI/api/V1/removebusinessobjectattachment/attachmentid/94510b89f346a7b9fd3c4c40f697ced4e361df75ee/busobid/9437f7ea070b26bebb78c74d1cb34b16dd3ea58995/busobrecid/94510b843b2071c278a22042858cd6da41a01da50c"
},
{
"name": "Get File",
"url": "http://csmweb2t.isd.lacounty.gov/CherwellAPI/api/V1/getbusinessobjectattachment/attachmentid/94510b89f346a7b9fd3c4c40f697ced4e361df75ee/busobid/9437f7ea070b26bebb78c74d1cb34b16dd3ea58995/busobrecid/94510b843b2071c278a22042858cd6da41a01da50c"
}
],
"owner": "",
"scope": 8,
"scopeOwner": "",
"type": 1
}
],
"errorCode": null,
"errorMessage": null,
"hasError": false
}

To create the attachment on the other system I am thinking that I will use this... I am going to test it..
PUT /api/V1/savebusinessobjectattachmenturl Attach a URL path


{
"busObId": "6dd53665c0c24cab86870a21cf6434ae",
"busObName": "incident",
"busObPublicId": "1697644",
"busObRecId": "94510bf5f3236c1cdce0d94c6e9362047fce1c9f68",
"comment": "string",
"displayText": "string",
"includeLinks": true,
"url": "dcsmweb2t.isd.lacounty.gov/.../94510b843b2071c278a22042858cd6da41a01da50c"
}

I tested it and it created something.

What it loaded is the link that I sent it.   So my question is how do I actually get the document?

The Get attachments by Business Object name and record ID  gave me a "Get File"  that's not my file?

I appreciate your help.  I think I got some information about my attachment but not the actual attachment.  

I appreciate any help.

Parents
  • You have to call GetBusinessObjectAttachment to get the attachment content.

  • I did.

    I called..

    GET /api/V1/getbusinessobjectattachments/busobname/{busobname}/busobrecid/{busobrecid}/type/{type}/attachmenttype/{attachmenttype}

    That's how I got this response.

    {
    "attachments": [
    {
    "attachedBusObId": "",
    "attachedBusObRecId": "",
    "attachmentFileId": "94510b89f88fdb243f5dd34dcba4d87a037873cfcf",
    "attachmentFileName": "C:\\Users\\e406702\\Desktop\\test2.txt",
    "attachmentFileType": "txt",
    "attachmentId": "94510b89f346a7b9fd3c4c40f697ced4e361df75ee",
    "attachmentType": 0,
    "busObId": "9437f7ea070b26bebb78c74d1cb34b16dd3ea58995",
    "busObRecId": "94510b843b2071c278a22042858cd6da41a01da50c",
    "comment": "",
    "created": "2019-08-15T10:30:51",
    "displayText": "test2.txt",
    "links": [
    {
    "name": "Remove",
    "url": "http://csmweb2t.isd.lacounty.gov/CherwellAPI/api/V1/removebusinessobjectattachment/attachmentid/94510b89f346a7b9fd3c4c40f697ced4e361df75ee/busobid/9437f7ea070b26bebb78c74d1cb34b16dd3ea58995/busobrecid/94510b843b2071c278a22042858cd6da41a01da50c"
    },
    {
    "name": "Get File",
    "url": "http://csmweb2t.isd.lacounty.gov/CherwellAPI/api/V1/getbusinessobjectattachment/attachmentid/94510b89f346a7b9fd3c4c40f697ced4e361df75ee/busobid/9437f7ea070b26bebb78c74d1cb34b16dd3ea58995/busobrecid/94510b843b2071c278a22042858cd6da41a01da50c"
    }
    ],
    "owner": "",
    "scope": 8,
    "scopeOwner": "",
    "type": 1
    }
    ],
    "errorCode": null,
    "errorMessage": null,
    "hasError": false
    }

Reply Children