HomeInterfacesRecipesChangelogFAQ
Log In
Interfaces

Get Port Weight

Endpoint

http://<server>:44000/api/v2/bin

Request parameters

ParameterMandatory?Data typeDescription
port_idTrueInt
(1-2000)
Identifies the Port.
timeout_modeFalseStringDetermines if one should wait for precision. Can be set to "L" (for Low/unstable precision), "H" (for High/stable
precision) or not set at all if one should not wait for precision.
timeout_valueFalseInt
(1-1024)
Specifies the timeout in milliseconds. If not defined, the default value for timeout_value is 0 milliseconds.

Request example

//Interface installation location(Ip adress)
string ip = "127.0.0.1";
//The URL to the bin interface
string url = "http://" + ip + ":44000/api/v2/bin";
//XML that will be POST'ed
string xmlData = string.Format(
@"<?xml version=""1.0""?>
<methodcall>
  <name>getportweight</name>
  <params>
    <port_id>4</port_id>
    <timeout_mode>L</timeout_mode>
    <timeout_value>10</timeout_value>
  </params>
</methodcall>");
//POST to interface
HttpResponseMessage response = await new HttpClient().PostAsync(url, new StringContent(xmlData,
        Encoding.UTF8, "application/xml"));
string responseString = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseString);
# Interface installation location (IP address)
ip = "127.0.0.1"
# The URL to the task interface
url = f"http://{ip}:44000/api/v2/bin"
# XML that will be POST'ed
xmlData ="""<?xml version="1.0"?>
<methodcall>
  <name>getportweight</name>
  <params>
    <port_id>4</port_id>
    <timeout_mode>L</timeout_mode>
    <timeout_value>10</timeout_value>
  </params>
</methodcall>"""
# POST to interface
response = requests.post(url, data=xmlData.encode('utf-8'), headers={"Content-Type": "application/xml"})
print(response.text)
const ip = "127.0.0.1";
const url = `http://${ip}:44000/api/v2/bin`;
const xmlData = 
`<?xml version="1.0"?>
<methodcall>
  <name>getportweight</name>
  <params>
    <port_id>4</port_id>
    <timeout_mode>L</timeout_mode>
    <timeout_value>10</timeout_value>
  </params>
</methodcall>`;

fetch(url, {
    method: 'POST',
    body: xmlData,
    headers: {
        'Content-Type': 'application/xml'
    }
})
    .then(response => response.text())
    .then(responseString => console.log(responseString));
<?xml version="1.0"?>
<methodcall>
  <name>getportweight</name>
  <params>
    <port_id>4</port_id>
    <timeout_mode>L</timeout_mode>
    <timeout_value>10</timeout_value>
  </params>
</methodcall>

Response parameters

ParameterData typeDescription
weight_statusStringDetermines if the weight is set with "L" (Low precision), "H" (High precision), "W" (Waiting for precision), or
“NA” (Not available: weight_value is locked to 0 gram).
weight_valueIntegerThe weight in grams.
weight_overloadStringDetermines if the Bin is overloaded ("OverloadDetected") or if the Bin is not overloaded ("NoOverloadDetected").

Response example

<?xml version="1.0"?>
<response>
  <params>
    <portweight>
      <weight_status>L</weight_status>
      <weight_value>370</weight_value>
      <weight_overload>NoOverloadDetected</weight_overload>
    </portweight>
  </params>
</response>

OR

<?xml version="1.0"?>
<response>
  <fault>
    <code>1000</code>
  </fault>
</response>

Error Codes

Error CodeDescription
1003Mandatory parameter port_id is missing.
1004Parameter port_id is not valid (invalid format or out of range).
1092Invalid parameter timeout_mode.
1093Invalid parameter timeout_value.

Software version requirement

Software Release April 2023