The community has a new login process
The community single sign-on system has been changed. Learn more about it HERE
Highlighted
bud12 Regular Contributor.
Regular Contributor.
114 views

json body to upload document serviceapi

Hello,

Can anyone provide an example for uploading a document and attaching it to an existing record?  I need the json body and the method called.  

Thanks

Tags (1)
0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

Re: json body to upload document serviceapi

If you want to upload the document and create the record in one requst then do not use json.  Use a multi-part form post.  If you want to upload the document seperately then use JSON and post something like this:

{
    "Uri":5762,
    "RecordTitle": {
        "Value": "My Title"
    },
"RecordRecordType":2,
    "RecordFilePath": "my file.docx"
}

From the samples included in the ServiceAPI: examples/uploadfromserver


Blog | Samples | HPE CM 9.3 SDK Docs
**Any opinions expressed in this forum are my own personal opinion and should not be interpreted as an official statement on behalf of MicroFocus**
bud12 Regular Contributor.
Regular Contributor.

Re: json body to upload document serviceapi

Thanks David,

Is there a way to send the file as part of the json?  The file isn't on the server

 

 

0 Likes
bud12 Regular Contributor.
Regular Contributor.

Re: json body to upload document serviceapi

Figured it out.   I created a multipart/form-data request and created the body in the stored proc adding the required fields

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.