Add Attachments to Ideas
You can use the ERPIntegrations REST API to upload a file to UCM. You use the DocumentId to add the file as an attachment to an idea, Idea 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 Idea REST API to add attachments to an idea:
- Encode the attachment to Base64.
- Upload the attachment to Oracle WebCenter Content.
- Add the attachment to the idea.
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 Idea
Let's take an idea SOLARBIKE, and add an attachment to it.
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/ideas/300100576910053/child/Attachments"
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", "CategoryName": "MISC" }
Example Response
Here's an example of the response body in JSON format:
{ "AttachedDocumentId": 300100576919161, "LastUpdateDate": "2023-01-25T23:48:33.613+00:00", "LastUpdatedBy": "PLM_AUTO", "DatatypeCode": "FILE", "FileName": "VSUpload.pptx", "DmFolderPath": null, "DmDocumentId": "UCMFA00007786", "DmVersionNumber": "7787", "Url": null, "CategoryName": "MISC", "UserName": null, "Uri": null, "FileUrl": "/content/conn/FusionAppsContentRepository/uuid/dDocID:7787?download&XFND_SCHEME_ID=1&XFND_CERT_FP=D92BD849BD3732723DC2D0E1F51A0627E3DBCAB7&XFND_RANDOM=584908941886989582&XFND_EXPIRES=1674691113945&XFND_SIGNATURE=LTQHqAyjU9dX7saXenT5~qSvNHAE9U3zOVo5kPz5Ov8QVeH9FjpM6Sy-ClxTcgl-zPY5cIRvdMGc7VxSxk97Rm4vYx3q2o-jsCRrotiuJY0sohMPCT30s03PbBc0XAKtwwDS~F~1s1gCt6CoVlNJhWP5PdkAJNNVPYv1ZxzyMDCSmeNfYRLUfS6~gTXHEAj8WLbhyjP0ecahxVdUe2estnZPaIKjt6BBpniKkW23h8PYw7kZpfuFwkYo~SV-dmiZ8pn9YuqgKecAd~p8aFCvhI99tOJigkT1FW16VIy7Ci1ygXVV95hgiCRbiMzj3vDHxRzBhbTvIMoP0YtZEqTlZA__&Id=7787", "UploadedText": null, "UploadedFileContentType": "application/vnd.openxmlformats-officedocument.presentationml.presentation", "UploadedFileLength": 83775, "UploadedFileName": null, "ContentRepositoryFileShared": "false", "Title": "VSUpload.pptx", "Description": "Uploading via REST", "ErrorStatusCode": null, "ErrorStatusMessage": null, "CreatedBy": "PLM_AUTO", "CreationDate": "2023-01-25T23:48:33+00:00", "ExpirationDate": null, "LastUpdatedByUserName": "AUTO PLM", "CreatedByUserName": "AUTO PLM", "AsyncTrackerId": null, "DownloadInfo": "{\"XFND_EXPIRES\":\"1674691113947\",\"XFND_SCHEME_ID\":\"1\",\"XFND_CERT_FP\":\"D92BD849BD3732723DC2D0E1F51A0627E3DBCAB7\",\"XFND_SIGNATURE\":\"OUAwYPmr99LR8xB-Lvfj-y8T86xD1CrfNugxQYN4DJFlGdmL0PUclBtAyBjkzu26aGSVs3Y9e-D0i-2u7Ka0Xgkb8TL3zVUW1IwZc-VTAjXMCyzjgwAlXEXkzsJ3Mx8Pc8u5ddJzdftDDuK8fhZrobZDfKQ13dS0c8mTceyNFc0wzaFmQTwDJXoY-Ps3dzAQmwaes1vCAkjyAvYJ1ZqquuzGeMOfh9NZCDbXtW4UihnapdCZx1sUWWE2p-KXkwp0~H-sE9zTCd9j1p1je6pkSXQvlI7Z-pyxCq4S1DqdukLIktvV~ldEJGyxpdBobhu6moXYhYI7jf94oJY~EiHeXQ__\",\"XFND_RANDOM\":\"5830753323817626558\"}", "links": [ { "rel": "self", "href": "https://servername/fscmRestApi/resources/version/ideas/300100576910053/child/Attachments/00020000000EACED00057708000110F09C48BE790000000EACED00057708000110F09C48BE78", "name": "Attachments", "kind": "item" }, { "rel": "canonical", "href": "https://servername/fscmRestApi/resources/version/ideas/300100576910053/child/Attachments/00020000000EACED00057708000110F09C48BE790000000EACED00057708000110F09C48BE78", "name": "Attachments", "kind": "item" }, { "rel": "parent", "href": "https://servername/fscmRestApi/resources/version/ideas/300100576910053", "name": "ideas", "kind": "item" }, { "rel": "enclosure", "href": "https://servername/fscmRestApi/resources/version/ideas/300100576910053/child/Attachments/00020000000EACED00057708000110F09C48BE790000000EACED00057708000110F09C48BE78/enclosure/FileContents", "name": "FileContents", "kind": "other" }, { "rel": "enclosure", "href": "https://servername/fscmRestApi/resources/version/ideas/300100576910053/child/Attachments/00020000000EACED00057708000110F09C48BE790000000EACED00057708000110F09C48BE78/enclosure/FileWebImage", "name": "FileWebImage", "kind": "other" } ] }