Upload an Attachment to the Affected Item through a Change Order

You can use the ERPIntegrations REST API to upload a file to Oracle WebCenter Content and use the Document ID to add it as an attachment to a Change Order Affected Item using the Product Change Orders V2 REST API.

Let's discuss these scenarios where, say, James is a product data steward who is preparing the production system for going live, and then uses the Product Change Order Services V2 REST API to add attachments to an affected item on a change order:

  • Encode the attachment to Base64.
  • Upload the attachment to Oracle WebCenter Content.
  • Add the attachment to the affected item on a change order.

Encode the Attachment to Base64

$ openssl base64 -in CADUsecases.pptx -out encode.txt

Upload the Attachment to Oracle WebCenter Content

Example URL

Use this resource URL format:

POST

curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.action+json" -d 'request payload' 
"https://servername/fscmRestApi/resources/version/erpintegrations"

Example Request

Here's an example of the request body in JSON format:
{
"OperationName":"uploadFileToUCM",
"DocumentContent":"<Paste Content from Step 1(make it single line text and not multiple lines)>",
"DocumentAccount":"scm$/item$/import$",
"ContentType":"file",
"FileName":"VSUpload.pptx",
"DocumentId":null
}

Example Response

Here's an example of the response body in JSON format:

{
    "OperationName": "uploadFileToUCM",
    "DocumentId": "7787",
    "DocumentContent": "wAAAAAAAACQAQF1AAAAAAAAAAAyIKAOAAAAAAAAAEBVzv3/AYZBeF51Y7Z8AAAAAElFTkSuQmCC",
    "FileName": "VSUpload.pptx",
    "ContentType": "file",
    "FileType": null,
    "DocumentAccount": "scm$/item$/import$",
    "Comments": null,
    "ProcessName": null,
    "LoadRequestId": null,
    "JobPackageName": null,
    "JobDefName": null,
    "ReqstId": null,
    "RequestStatus": null,
    "JobName": null,
    "ParameterList": null,
    "NotificationCode": null,
    "CallbackURL": null,
    "JobOptions": null,
    "StatusCode": null,
    "ESSParameters": null,
    "links": [
        {
            "rel": "self",
            "href": "https://servername/fscmRestApi/resources/version/erpintegrations/uploadFileToUCM",
            "name": "erpintegrations",
            "kind": "item"
        },
        {
            "rel": "canonical",
            "href": "https://servername/fscmRestApi/resources/version/erpintegrations/uploadFileToUCM",
            "name": "erpintegrations",
            "kind": "item"
        }
    ]
}

Add the Attachment to the Affected Item on a Change Order

Let's take a change order, CO9898, with LAPTOPPRO as an affected item, using the Product Change Orders V2 REST API.

Example URL

Use this resource URL format:

POST

curl -u username:password -X POST -H "Content-Type:application/vnd.oracle.adf.action+json" -d 'request payload' 
"https://servername/fscmRestApi/resources/version/productChangeOrdersV2/300100570632018/child/changeOrderAffectedObject/00020000000EACED00057708000110F09BE8CF630000000EACED00057708000110F09BE8CF63/child/changeOrderAffectedItemAttachment"

Example Request

Here's an example of the request body in JSON format:
{
"FileName": "VSUpload.pptx",
"Title": "VSUpload.pptx",
"Description":"Uploading via REST",
"DmVersionNumber": "7787",
"CategoryCode": "MISC"
}

Example Response

Here's an example of the response body in JSON format:

{
"LastUpdateDate": "2023-01-06T23:30:05.164+00:00",
"LastUpdatedBy": "PLM_AUTO",
"DatatypeCode": "FILE",
"FileName": "VSUpload.pptx",
"DmDocumentId": "UCMFA00007786",
"DmVersionNumber": "7787",
"Url": null,
"UploadedText": null,
"UploadedFileLength": 83775,
"Title": "VSUpload.pptx",
"Description": "Uploading via REST",
"DownloadInfo": "{\"XFND_EXPIRES\":\"1673048404969\",\"XFND_SCHEME_ID\":\"1\",\"XFND_CERT_FP\":\"D92BD849BD3732723DC2D0E1F51A0627E3DBCAB7\",\"XFND_SIGNATURE\":\"O8hscPU9cg72kqQhXEseY1UF9Y3XPOMwlJ8YMIlXQ3vfoO8mYLG7tnWqK23czEuDk~c3seNj3beHl85qFPpbXPYvLT9NVnjyq8HMOjlPdqOTRPSLFfkPp8oxHfuUz-srbvzAR0WLny3b2KhkzWTuEKt6TkkmAnxM2fD~EX1T61zPporACvTPVHl8WOmhrLpjj8AsoUkhH3YkwD6Z3rlVLwpHJIqX0rwW519J1RV0kJ~-mUEelMOXfz7poscXoBzpXb~IO25x-FA4rfrfQtzVf3~7ia5DTJqApH~Sin75vG9dW~c67Se~qchkk5xtbldG3MYDvXUxSPltf455bFqgVg__\",\"XFND_RANDOM\":\"-4672633785897272653\"}",
"CategoryCode": "MISC",
"links": [
{
"rel": "self",
"href": "https://servername/fscmRestApi/resources/version/productChangeOrdersV2/300100570632018/child/changeOrderAffectedObject/00020000000EACED00057708000110F09BE8CF630000000EACED00057708000110F09BE8CF63/child/changeOrderAffectedItemAttachment/00020000000EACED00057708000110F09BE8B18F0000000EACED00057708000110F09BE8B18E",
"name": "changeOrderAffectedItemAttachment",
"kind": "item"
},
{
"rel": "canonical",
"href": "https://servername/fscmRestApi/resources/version/productChangeOrdersV2/300100570632018/child/changeOrderAffectedObject/00020000000EACED00057708000110F09BE8CF630000000EACED00057708000110F09BE8CF63/child/changeOrderAffectedItemAttachment/00020000000EACED00057708000110F09BE8B18F0000000EACED00057708000110F09BE8B18E",
"name": "changeOrderAffectedItemAttachment",
"kind": "item"
},
{
"rel": "parent",
"href": "https://servername/fscmRestApi/resources/version/productChangeOrdersV2/300100570632018/child/changeOrderAffectedObject/00020000000EACED00057708000110F09BE8CF630000000EACED00057708000110F09BE8CF63",
"name": "changeOrderAffectedObject",
"kind": "item"
}
]
}