Showing results for 
Search instead for 
Did you mean: 

Save binary object via API 2

Former Member
0 Kudos

How do I save a file via the API 2?

Any exsample will help me alot!

I'm trying to save a object to the table Binary_Objects, but I get the error: " Server error (0xffaab000)"

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I assume you are trying to create a BinaryBlobRecord in the Binary_Object Table.

Here is some code that works:

BinaryBlobRecord record = RecordFactory.createEmptyBinaryObjectRecord(tableId);

record.setBinary(new BinaryValue(bytes));

record.setDataSize(new IntegerValue(size));

record.setHasOriginal(new BooleanValue(true));

record.setDataGroupId(node.getId()); // get the node using RetrieveGroupTreeCommand command.

record.setSource(new LookupValue(new RecordId(1))); // see below

record.setCode(name); // The code has to be unique, so you can add a random number to the name.

record.setName(new StringValue(name))

CreateRecordCommand createRecordCommand = new CreateRecordCommand(connection);




  • If you don't set the source properly , you will get that error. For setSource method, you need to set a Location ID. With API 5.5 SP5, most likely there is no way to create a new location ID and we have to use one of the existing Location IDs. Just to make the code work, I used "new LookupValue(new RecordId(1)) ", which requires having at least one file uploaded to the table via MDM Data manager and use the first part of its location ID.

  • For setDataGroupID, first create the group node in the MDM Data Manager and find the node in the GroupTree with API. To get the GroupTree, use RetrieveGroupTreeCommand.

Former Member
0 Kudos

Hi Amir

Thank you very much for the code.

It helped me alot and my code is now working.

Answers (0)