Put

TwinCAT TIA
Network REST Client ActiveClients One client

ns=2;s=DEPRAG Smart/Network/HTTP/REST/ActiveClients/0/Put

Sends a PUT command to a URL.

Parameters:

    Content
    Content of the data passed in the HTTP command.

Returns:

    Put
    A variable of type OpcMethodReturnValueHttpResultWithStringContent. The Result property contains the command-specific return values.
      Result
      A variable of type HttpResultWithStringContent.
        Success
        Indicates whether the HTTP command was successfully fired.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bHttpPut
    A Boolean variable that can be used to trigger the execution of the Put command.
    OutputDataHttpPut
    An instance of the ST_HttpResultWithStringContentOutputData structure to which the return value of the Put method is written.
    hrHttpPut
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    fbHttpRest
    An instance of the "FB_HttpRest" function block supplied with the DEPRAG Smart library.
    sRequestUri
    A string(255) variable specifying the endpoint to which the command should be sent.
    sContent
    A string(255) variable representing the content to be sent.
    sClientId
    A String(255) variable that specifies the client that should execute the command.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bHttpPut   : BOOL;
   OutputDataHttpPut : ST_HttpResultWithStringContentOutputData;
   hrHttpPut   : HRESULT;
 
   fbHttpRest   : FB_HttpRest;
END_VAR

hrHttpPut := fbHttpRest.Put(
       bExecute   := bHttpPut, 
       ConnectionHandle:= depragSmartConnection.ConnectionHandle,
       sRequestUri  := '/testPut',
       sContent   := 'TestContent',
       sClientId   := '0',
       OutputData  => OutputDataHttpPut);
IF hrHttpPut <> S_FALSE THEN 
    bHttpPut := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".