Upload Document Object
The Upload Document Object API uploads a streamed file to an IDO document object.
Note: This topic is for REST Version 1. There is also an API for REST Version 2.
Parameters
| Name | In | Required? | Description |
|---|---|---|---|
| responsetype | Path | Yes | Response request data format: Supply any of these values:
|
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 | This is the name of a configuration that is available on the application server. This is required only when using the Mongoose API through the ION API. |
| X-IdoName | This is the name of the IDO collection. |
| X-RowPointer | This is the value of the IDO row pointer. |
| X-DocName | This is the name of the document object. |
| X-DocExt | This is the file extension used for the document object. |
| X-DocDesc | This is the description of the document object. |
Request data
The request object is an unencoded binary stream of a file.
Response data in XML format
<MGRestIOResponse>
<Success>true</Success>
<Message>
Match count: 6
Updated item count: 1
</Message>
<MessageCode>700</MessageCode>
</MGRestIOResponse>
Response data in JSON format
{
"Message": "Match count: 6 Updated item count: 1",
"MessageCode": 700,
"Success": true
}
Example
This example code uploads a file and attaches it as a document object of the referenced IDO and IDO row pointer.
string xml = string.Empty;
using ( var client = new HttpClient() )
{
// optionally, you can use json as the response type
string requestUrl = $"http://server/IDORequestService/MGRESTService.svc/io/xml/uploaddocobj";
// provide token in the Authorization header
client.DefaultRequestHeaders.TryAddWithoutValidation(
"Authorization",
"b/XdI6IQzCviZOGJ0E+002DoKUFOPmVDkwpQDbQj…==" );
client.DefaultRequestHeaders.Add( "X-IdoName", "UserNames" );
client.DefaultRequestHeaders.Add( "X-RowPointer", "2807a627-577b-462e-9494-aee568152c54" );
client.DefaultRequestHeaders.Add( "X-DocName", "WeeklyReport" );
client.DefaultRequestHeaders.Add( "X-DocExt", "docx" );
client.DefaultRequestHeaders.Add( "X-DocDesc", "Weekly Report" );
// 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();
xml = result.Result;
}
}