UploadFileStream

The UploadFileStream API uploads a streamed file to an IDO collection. The IDO collection must have a property for storing binary data.

Note: This topic is for REST version 2. Seer Upload File Stream for the REST version 1.
POST /file/{ido}
http://localhost/IDORequestService/ido/file/UserNames?property=UserImage&itemId=PBT=[UserNames] UserNames.DT=[2018-09-0511:01:00.167] UserNames.ID=[7d38e4fb-e1a8-4af7-936b-50accee5d35b]

Parameters

Name In Required? Description
ido Path Yes The name of the IDO collection
property Query Yes The name of the IDO property to be used for storing binary data
itemid Query Yes The value of the _itemID property

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.

X-IdoName The name of the IDO collection
X-Property The name of the IDO property
X-RowPointer The value of the IDO row pointer

Request data

Unencoded binary stream of the file.

Response data

{
   "Message": null,
   "Success": true
}

Example

This example code uploads a user image to the Users table.

string json = string.Empty;
 
using ( HttpClient client = new HttpClient() )
{
   string ido = "UserNames";
   string property = "UserImage";
   string itemid = "PBT=[UserNames] UserNames.DT=[2019-05-29 14:12:02.000] UserNames.ID=[4d6cb1eb-e4fc-4e12-aae8-95ff1086ee8c]";
   string requestUrl = $"http://server/IDORequestService/ido/file/{ido}?property={property}&itemid={itemid}";
 
   // 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;
   }
}