GetBin

Syntax

<web service URL>/GetBin?<operation parameters>

Description

The GetBin operation is used to get binary data from server using GET request.

Comments

Operation parameters contain a moniker and different additional parameters. Depending on the object, for which operation is executed, the repository connection moniker or the opened object instance moniker is specified as a moniker. The required monikers are returned by various Open* operations.

A parameter and its value are separated with the = character in the address bar; different parameters are separated with the & character.

Available parameters of the GetBin operation:

Parameter Description
mon Moniker of the object, for which operation is executed.
Available moniker types:
  • <repository connection moniker>!$Sys! + <repository_document_identifier>. It is used to get contents of the document saved in repository.
  • <repository connection moniker>!Preview! + <object_key>. It is used to get repository object thumbnail as PNG.
  • <dashboard moniker>!BinItem! + <id/key>. It is used to get an image with the specified identifier or key from dashboard.

The monikers, which are the PutBin operation execution result, can also be used.

attach Indicates whether to load document.
Available parameter values:
  • 1. Loading document, the attachment parameter is added to the title of created link. Example: &attach=1.
  • 2. Opening document by internal browser view, the inline parameter is added to the title of created link. Example: &attach=2.
fileName File name, with which loading is executed. It is used with the attach parameter. Example: &attach=1&fileName=report.xls.

IMPORTANT. Parameter names are case-sensitive.

Example

Below is the example of code of HTML page that is used to get binary data by means of the GetBin operation. Opening the page connects to repository and two operations are executed:

Operation execution results are opened on new browser tabs.

To reduce the example, the PostRequest function script is excluded from the code, the function is used to execute operations in JSON format. See code of this function in the Connecting to Repository article.

<!DOCTYPE html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Using the GetBin operation</title>
</head>
<body>
    <script language="javascript" type="text/javascript">
        var svc = "http://localhost:9090/axis2/services/PP.SOM.Som";
        OpenMetabase = { "OpenMetabase": { "tDef": { "id": "PPREPOSITORY" }, "tCreds": { "user": { "id": "pprepository" }, "pass": "pprepository" } } }
        OpenMetabaseResult = PostRequest(svc, OpenMetabase);
        /*
            PostRequest script
        */
        //Executing GetBin
        url = svc + "/GetBin?mon=" + OpenMetabaseResult.OpenMetabaseResult.id + "!$Sys!LOGO";
        window.open(url);
        url = svc + "/GetBin?mon=" + OpenMetabaseResult.OpenMetabaseResult.id + "!Preview!12345";
        window.open(url);
    </script>
</body>
</html>

See also:

Additional Operations