UploadDocumentObject
The UploadDocumentObject API uploads a streamed file to an IDO document object.
Note: This topic is for REST version 2. See Upload Document Object for the REST version 1.
| POST | /docobj/{ido} |
|---|---|
| http://localhost/IDORequestService/ido/docobj/UserNames?rowPointer=8c66c936-d348-4c13-8684-69bc6fa10473&name=WeeklyReport&desc=Weekly%20Report&ext=xls | |
Parameters
| Name | In | Required? | Description |
|---|---|---|---|
| ido | Path | Yes | The name of the referenced IDO collection |
| itemid | Query | Yes | The value of the _ItemID property for the document object |
| rowPointer | Query | No | The value of the referenced IDO row pointer
Note: Use this parameter to upload a new document object and link the object to the referenced IDO and row pointer.
|
| name | Query | No | The name of the document object |
| desc | Query | No | The description of the document object |
| ext | Query | No | The file extension for the document objects |
Headers
| Name | Description |
|---|---|
| Authorization | If the API is called directly, then a Mongoose security token is obtained through a call to the GetSecurityToken API.
If the API is called through ION API, then a valid OAuth2.0 bearer token is provided by ION API. |
| X-Infor-MongooseConfig | The name of a configuration that is available on the application server
This header is required only when using the Mongoose API through the ION API. |
Request data
Unencoded binary stream of the file.
Response data
{
"Message": null,
"Success": true,
"ItemId": "PBT=[DocumentObjectAndRefView] doc.ID=[7018e6d1-7397-466a-be43-17c52d51c3d6] doc.DT=[2018-11-22 09:30:16.643]"
}
Example
This example code uploads a file and attaches it as a document object of the referenced IDO and IDO row pointer.
string json = string.Empty;
using ( HttpClient client = new HttpClient() )
{
string ido = "UserNames";
string rowpointer = "4d6cb1eb-e4fc-4e12-aae8-95ff1086ee8c";
string requestUrl = $"http://server/IDORequestService/ido/docobj/{ido}?rowpointer={rowpointer}&name=WeeklyReport&desc=Weekly%20report%20for%20this%20week&ext=docx";
// provide token in the Authorization header
client.DefaultRequestHeaders.TryAddWithoutValidation(
"Authorization",
"b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDbQj…==" );
// select an image or a file and include it as the request payload
OpenFileDialog dialog = new OpenFileDialog();
byte[] file = new byte[] { };
if ( dialog.ShowDialog() == DialogResult.OK )
{
file = File.ReadAllBytes( dialog.FileName );
}
// pass the file as the request data and send the post request
HttpResponseMessage response = client.PostAsync( requestUrl, new ByteArrayContent( file ) ).Result;
using ( HttpContent content = response.Content )
{
Task<string> result = content.ReadAsStringAsync();
json = result.Result;
}
}