Barcode Xpress for Java v13.9 - Updated
Upload Files to the Work File Service
Developer Guide > How To > Use the Barcode Scanner REST API > Upload Files to the Work File Service

To use the Barcode Scanner REST API to decode barcodes present in your image files, first upload these images to the Accusoft Cloud. Files uploaded in this way are referred to as work files, and are temporarily stored for further processing.

To upload a work file, post the image file to the /PCCIS/V1/WorkFile endpoint at https://api.accusoft.com. You will need to provide an Accusoft Cloud API Key in order to upload work files. For image files, you should always provide file extension as a request parameter, and you should also explicitly set the content type of your request as application/octet-stream.

var client = new HttpClient();
client.BaseAddress = new Uri( @"https://api.accusoft.com");
client.DefaultRequestHeaders.Add("acs-api-key", "YourAPIKey"); // <-- API Key Here

// Upload image which contains the barcodes we wish to scan
var content = new StreamContent(File.OpenRead(@"./yourimage.bmp")); // <-- Image path here
content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/octet-stream");
var response = await client.PostAsync(@"/PCCIS/V1/WorkFile?FileExtension=bmp", content);

Receiving a 200 status code back from the work file service indicates that your file has been successfuly uploaded, and a JSON response body will be sent back which provides you with important information about the work file that you will need for subsequent requests to Accusoft's Cloud APIs which work with your uploaded images:

{
    "fileId": "Xe6zv3dH0kVSzLuaNhd32A",
    "fileExtension": "bmp",
    "affinityToken": "ejN9/kXEYOuken4Pb9ic9hqJK45XIad9LQNgCgQ+BkM="
}

For more information see the Work File API Reference.

Is this page helpful?
Yes No
Thanks for your feedback.