Please enable JavaScript to view this site.

Modifies one or more attributes of one or more file records

 

PATCH: api/v1/<apiresource>/crud/<filename>

 

<apiresource> ApiResource name. e.g. apidemo.
 

<filename> Name of the file on which the operation is performed. e.g. LK.CUSTOMERS
e.g. api/v1/apidemo/crud/LK.CUSTOMERS/

 

Update_Partial operation has 2 more variants: DICTIONARIES and SCHEMA. The difference between the 3 variants is in how the results are displayed.

Input and output parameters are the same in all 3 variants, and the differences are present only when records have multivalues.

For more information, see Response section below.

 

 

PATCH (DICTIONARIES mode): api/v1/<apiresource>/crud/dict/<filename>

PATCH (SCHEMA mode): api/v1/<apiresource>/crud/sch/<filename>

 

 

 

Parameters

 

dictionaries

string

List of dictionaries to write, separated by space.  You may use the format LKFLDx where x is the attribute number. This parameter is mandatory if the request body has plain/text format. For other cases, dictionaries are inside each record in the RECORDS tag.

optimistic_locking

string

Checks out if the file has not been modified by another user

read_after

boolean

Reads the record again and returns it after the update. “calculated”, “dictionaries”, “conversion”, “format_spec” and “original_record” will only be effective if this option is true.

calculated

boolean

Return the resulting values from the calculated dictionaries.

conversion

boolean

Execute the defined conversions in the dictionaries before returning.

format_spec

boolean

Execute the defined formats in the dictionaries before returning

original_record

boolean

Return a copy of the records in MV format.

custom_vars

string

This is a free text field to send in the transaction. If not empty, subroutine SUB.LK.MAIN.CONTROL.CUSTOM will be called. Add custom code to that subroutine to define special behaviours for some or all transactions.

svr_timeout

integer

This is the maximum time in seconds that the client will wait for a response. Use 0 for no timeout.

(*) Mandatory

 

 

 

Request Body

 

application/json

The entry record has the following structure:

 

 

It is not necessary to define ALL attributes, only those to be modified. Attributes not defined will remain with their previous values.

 

If optimistic locking parameter is activated, ORIGINAL_RECORD tag must be included. The content of this tag its always a MV buffer as is, with its attribute, multivalue and subvalue marks. If the content of the MV buffer has invalid JSON characters, like double quotation, they must be escaped.

 

 

application/xml

The entry record has the following structure:

 

 

It is not necessary to define ALL attributes, only those to be modified. Attributes not defined will remain with their previous values.

 

In this example we have LK.CUSTOMERS file with dictionaries for its 3 attributes. Thats why the names of the dictionaries are displayed (NAME, ADDR and PHONE), otherwise only LKITEMID would be displayed.

To define each attribute, new nodes have to be added with the name LKFLDn, where n is the number of the attribute.

 

If optimistic locking parameter is activated, ORIGINAL_RECORD tag must be included. The content of this tag its always a MV buffer as is, with its attribute, multivalue and subvalue marks. If the content of the MV buffer has XML invalid characters, they must be escaped.

 

 

text/plain

The entry record has the following structure:

 

 

In this structure, there are three main blocks separated by the FS character (ASCII 28). The first part is the list of records IDs, the second one is the list of records MV buffer and the third one (optional) is the list of original MV buffers of each record.

 

In case of being more than one element in any of the three lists, they must be separated with each other with the RS character (ASCII 30).

 

The MV buffers are the records as is, with attribute (AM), multivalue (VM) and subvalue (SM) marks.

 

The list of original MV buffers of each record is mandatory when the option optimistic_locking is activated.

 

Important: It is not necessary to define ALL attributes, only those to be modified. Attributes not defined will remain with their previous values. Those attributes to be modified must be defined inside dictionaries parameter and their values must be defined in the same order as the dictionaries and separated with the AM attribute mark.

 

 

 

Responses

There are 3 different ways of displaying the results. In JSON,XML formats and plain text (LkString). However, the response will always be displayed in the same format of the request body sent. This means that if the request body was in JSON format, the results will be displayed in JSON, regardless of the Media Type value selected for the response.

 

On all kind of responses, an ERROR tag will list all possible errors during execution of the operation. This tag includes CODE tag with the error codes and MESSAGE tag with messages of each error.

In responses of type "text/plain" (LkString MV), error codes and messages are separated by multivalue marks.

 

application/json

The image below shows the usual response when the application/json is selected as Media Type. The response can have multiple variants.

For more information, click here.

 

 

 

application/xml

The image below shows the usual response when the application/xml is selected as Media Type. The response can have multiple variants.

For more information, click here.

 

 

 

text/plain

Response is displayed in text format. This response is a chain of characters structured in sections, named LkString.For more information about the different tags in this response, click here.