Changes for page API methods
From version 5.1
edited by Vera Retyeva
on 2024/03/06 08:48
on 2024/03/06 08:48
Change comment:
There is no comment for this version
To version 4.1
edited by Vera Retyeva
on 2024/03/06 08:01
on 2024/03/06 08:01
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -4,23 +4,23 @@ 4 4 * {{showhide showmessage="Why do some API methods return the $type property in their responses?" hidemessage="Why do some API methods return the $type property in their responses?"}}|(% style="border-color:white" %)((( 5 5 (% class="box infomessage" %) 6 6 ((( 7 -**Note:** It is reccomended to read about{{html}}<a href="https://docs.loymax.net/xwiki/bin/view/Main/General_information/Used_technologies/">the technology stack</a>{{/html}} used by the Loymax System.7 +**Note:** It is reccomended to read about{{html}}<a href="https://docs.loymax.net/xwiki/bin/view/Main/General_information/Used_technologies/">the technology stack</a>{{/html}} used by the Loymax system. 8 8 ))) 9 9 10 10 ((( 11 -Objects used in the **.Net** framework are converted from a data structure to a sequence of bytes or a string.This formatmakesiteasierto transfer and store data.11 +Objects used in the **.Net** framework are translated from a data structure to a sequence of bytes or a string. In this format it is convenient to transfer and store data. 12 12 13 13 (% class="box" %) 14 14 ((( 15 -The process of converting an object state into a stream of bytes in order to store them inthePC memory, database or file is called **serialization**. The main purpose of serialization is to save the state of an object so that itcanbe restoredif necessary.16 -The reverse conversion of bytes into a data structure is called **deserialization**.15 +The process of translating an object state into a stream of bytes in order to store them in PC memory, a database or a file is called **serialization**. The main purpose of serialization is to save the state of an object so that it is possible to restore it if necessary. 16 +The reverse translation of bytes into a data structure is called **deserialization**. 17 17 ))) 18 18 19 -The Loymax System uses the **Newtonsoft.Json.JsonSerializer** for serialization/deserialization.19 +The Loymax system uses the **Newtonsoft.Json.JsonSerializer** for serialization/deserialization. 20 20 ))) 21 -)))|(% style="border-color:white" %){{lightbox image=" Serialization.png"/}}21 +)))|(% style="border-color:white" %){{lightbox image="Group 1 (1).png"/}} 22 22 23 -Let's considerthe serialization/deserialization processusingan example of how the method works for {{html}}<a href="https://docs.loymax.net/xwiki/bin/view/Main/Integration/Ways_to_use_API/API_methods/Methods_of_public_api/Brands/#H41F43E43B44344743543D43843544143F43844143A43043144043543D43443E432">to geta list of brands</a>{{/html}}23 +Let's take the serialization/deserialization process as an example of how the method works for {{html}}<a href="https://docs.loymax.net/xwiki/bin/view/Main/Integration/Ways_to_use_API/API_methods/Methods_of_public_api/Brands/#H41F43E43B44344743543D43843544143F43844143A43043144043543D43443E432">receiving a list of brands</a>{{/html}} 24 24 25 25 ((( 26 26 ... ... @@ -27,17 +27,17 @@ 27 27 ))) 28 28 29 29 |(% style="border-color:white" %)((( 30 -All brands in the System are created using the same template (model), i .e.they arederived from the same data type.30 +All brands in the System are created using the same template (model), that is, they are inherited from the same data type. 31 31 32 32 The algorithm for obtaining information about brands through API methods works as follows: 33 33 34 -1. The c ustomersends a request for a list of brands (##GET: /v1.2/brands###).35 -1. The server processes the request, generates and sends an SQL query to the database to getthelist of brands.36 -1. The database respon ds totheserver'srequestbyreturninga list of brands that arecoverted fromabyte stream back to a **.Net** object.37 -1. The server returns a list of brands to the customerin JSON format. The **Newtonsoft.Json.JsonSerializer **converts the **.Net** object into JSON format.34 +1. The client sends a request for a list of brands (##GET: /v1.2/brands###). 35 +1. The server processes the request, generates and sends an SQL-query to the database to get a list of brands. 36 +1. The database, in response to a server request, returns to the server a list of brands that are translated from the byte stream back into a **.Net** object. 37 +1. The server returns to the client a list of brands in JSON format. The **Newtonsoft.Json.JsonSerializer **converts the **.Net** object into JSON format. 38 38 )))|(% style="border-color:white" %)[[image:BrandBase.png]] 39 39 40 -For example, **.NET** contains **Brand1 ** and **BrandBase**types(**Brand1 ** is inheritedfrom **BrandBase**).40 +For example, in **.NET** there are types **Brand1 ** and **BrandBase **(**Brand1 ** inherits from **BrandBase**). 41 41 42 42 (% class="box" %) 43 43 ((( ... ... @@ -52,16 +52,16 @@ 52 52 }## 53 53 ))) 54 54 55 -**Newtonsoft JsonConvert** adds the**$type ** property to JSON schema for types during serialization and uses it during deserialization.55 +**Newtonsoft JsonConvert** adds **$type ** property to JSON schema for types during serialization and uses it during deserialization. 56 56 57 -Thus, serializa tion of the **Brand1**classinstancewill create a JSON object with the abovementioned **$type** property.57 +Thus, serializing an instance of the **Brand1 class ** will create a JSON object with the aforementioned **$type** property. 58 58 59 59 (% class="box infomessage" %) 60 60 ((( 61 -**Brand1** is an object created using the **BrandBase** type. Since the serializer expects to get onlytheobject of the **BrandBase**type, and **Brand1**isrecognizedas a separate type that is inheritedfrom the common **BrandBase**type, it assigns the ##$type## propertyto it, which specifies the model accordingtowhichthe object was created,inorderto create an object of the originaltype during deserialization.61 +**Brand1 **is an object created using the **BrandBase** type. Since the serializer expects to get only an object of type **BrandBase**, and **Brand1 **recognizes it as a separate type that inherits from the common type **BrandBase**, it assigns it the ##$type## property, which specifies the model that the object was created with, to create an object of the source type during deserialization. 62 62 ))) 63 63 64 - The response toa requesttogeta list of brandswill contain thefollowing information about **Brand1**:64 +In the response to the query for a list of brands, the information about **Brand1 **will look like this 65 65 66 66 (% class="box" %) 67 67 (((