Standard odata interface. OData and other web-based APIs

The ability to automatically format the REST OData interface for anything has been implemented. applied solutions. With this rank, we have the opportunity to give public access third party supplement to the 1C database is literally a few clicks away.

This mechanism Purposes for the development of decals often include tasks:

  • Vivantage/improvement of data from applied solutions;
  • Integration with Internet sites (online stores);
  • increasing the functionality of the application solution without changing the configuration;
  • Integration with others corporate systems(Inodes without additional programming).

The REST OData interface allows for the rapid exchange of data between 1C databases, and some of this also includes other manual mechanisms, so the main purpose of the REST OData interface is for third-party integration mi systems.

It’s easy to understand that OData clients exist on all major platforms, and related libraries can be imported.

In this article, I will try to report on what the REST OData interface is and how it can be used.

Publish REST to OData interface

To use the OData interface, we need to publish it, and for this we need a web server - Apache 2.2 or IIS (starting with Apache 2.4). Then you need to go to the menu “Administration” -> “Publish on a web server...”.

The window will fill in the required fields and will be marked “Publish”:

After this, it is necessary to assign a warehouse to the OData interface. indicate which objects should be changed before entering, and which ones not (as of now, there is no desired object in the warehouse).

It can be done approximately like this:

&OnServerProcedureInstallODataOnServer() tArray = New Array;

tArray.Add(Metadata.Providers.Products);

Install the Warehouse of the Standard OData Interface (t Array); KinetsProcedures

&On the server

ProcedureInstallODataOnServer()

t Massiv = New Massiv;

tArray. Add(Metadata. Providers. Products) ;


SetStockStockStandardInterfaceOData(tArray);

  • KinetsProcedures
  • What are the most important benefits associated with business benefits? Some of the most important ones are the following:
Those that exist in 1C first of all were briefly described in the section “Customization and support” of this article; We will return to this topic in one of our upcoming articles. Today's news is about another task, about integration.

Integration departments

Integration tasks may vary. For some, a simple interactive exchange of data is needed, for example, to transfer a list of employees to the bank for issuing plastic salary cards. For complex tasks, it may be necessary to automate the exchange of data, possibly from integration with the business logic of the external system. Є tasks that may have a specialized character, in line with integration from external possessions (for example, trade owners, mobile scanners etc.) either with reduced or highly specialized systems (for example, with RFID tag recognition systems). It is very important for the skin to select the most suitable integration mechanism.

Possibility of integration with 1C

Explore different approaches before implementing integration with 1C add-ons, which one to use is subject to specification.

Let's be clear that we have an information base on the 1C:Enterprise 8 platform, data that we need to work with regularly. Unfortunately, we don’t have the ability to make any changes before the current configuration. Possibly ce (for the evidence of a full-value platform); or bezkoshtovna "1C: UNF for Ukraine. Micro"; or through achievements automatic update I don’t want to take off the trim; but the service company called the excellence of its employees, as it did not take away the praise from the service provider, and the powerful “1C programmer” is missing...

And the axis of such minds is your task with the integration of this base and the entire external system. What options do we have? It is possible to add me in the comments, but I am still learning exactly 5 nobles:

  1. Access to the database through the family COM objects(V83.ComConnector and earlier). Obmezhennya: The platform is installed on Windows.
  2. Direct access database tables. Axis butt for DBMS. . Obmezhennya: fencing of central access to the licensed land; instability of access; Changing the data can lead to the destruction of the logical integrity of the database.
  3. Starting with platform version 8.3.5, it became possible to provide access to data via automatic REST interface according to the OData v.3.0 protocol. Obmezhennya: It is necessary to install the web server and the web server extension module from the platform.
  4. Starting with platform version 8.3.6, having appeared expansion mechanism This allows you to “plug in” new functionality without making changes to the main configuration. Among the new functionality we benefit from are WEB and HTTP services. Starting with platform version 8.3.11, the ability to expand the structure of the database table (adding new details for saving service data using the integration method) became available. Obmezhennya: it is necessary to have a programmer who can develop extensions and speed up his efforts to update; For services, it is necessary to install a web server and a web server extension module as part of the platform.
  5. You can use "mitta access" and then you can vikorist launching external processes using additional parameters command line/Execute. In such a scenario, you can regularly run the following processing steps to check the external resource for the validity of the instructions before finishing it and place the results of your work there. You can also independently launch the 1C client add-on to run your commands, which includes access to the OS in which the database is located. Obmezhennya: it is necessary to have a programmer who can create the process; the presence of a time lag in the system’s response to a significant gap between launches of the scheduler or the hourly start of client programs.

Thus, among the 5 options, the most popular and easiest way for the administrator is automatic access via the oData protocol. This option is cross-platform.

And the option with the oData protocol is less expensive due to the connection with the 1C database. On the right is that the Microsoft company is pushing it through. In addition to the release of OData SDK for development of PID.NET, AJAX, PHP, Java, JavaScript, WebOS and Objective-C, this company introduced this protocol in its popular products: Excel, PowerPoint, SharePoint, MsSQL and others. Thus, you do not need to create your own version of CommerceML and parse XML and JSON texts both on your side and on the side of the 1C database, if you implemented your own WEB and HTTP services. With the use of OData, you will immediately have ready-made libraries for extracting or modifying data for storage in your external systems, at that time, on the 1C side of the database, everything will be automatic.

Has Khvilina passed away yet?

We can see - we no longer have enough common boundaries and we can work on integration as we want! I specially mocking our fantasy on the cob, Choob Bolito Dovo not to be overshadled by all the warts of the Books "Technology INTEGRACHICA: ISBN 978-5-9677-1462-7 Goncharova D.I. and Khrustaleva E.Yu (and no longer waste an hour on overexamining the weaknesses of these options). You can take my word for it or you can start a discussion in the comments, but the OData option is still not the most advantageous.

For those who are interested in the topic, please go to the official website of the protocol – www.odata.org. Once again I show my respect for not caring about those who current version The protocol is already 4.0 and it was standardized by the OASIS consortium on March 17, 2014, and in the “1C:Enterprise 8” platform, as before, the protocol is being developed more earlier versions 3.0. Before speaking, don’t forget to look at the ecosystem protocol section and have mercy on our 1C:Enterprise riddle, which is first on the list :))

Necessary adjustments

As I already guessed, you have a web server. Starting with version 8.4, the server part of the platform will already have its own web server, but for now we will need to use third-party ones - IIS or Apache. How to set everything up is well described in the same book for the administrator. If you love pictures and other people's evidence, then you laugh at the joke: , and especially :) I can’t vouch for the completeness and relevance of the data in these articles and I don’t know the authors. If you encounter problems, read the Administrator's Guide for your version of the platform - everything you need is there.

Since you have already installed a web server and Windows no longer crashes when starting due to problems with extended access to 1C (let’s guess - you installed a 32-bit Apache and a 64-bit platform), a little was lost. In the configurator, go to the “Administration” menu and click on the “Publish on a web server...” command. At the end it is necessary to indicate upcoming important points:

  • The name of your database in the “Name” field, which web server allows access to it (if you don’t want problems, don’t write in Cyrillic);
  • Indicate the web server that is installed on this computer(if you have two web servers installed, then the list that appears will appear when you select);
  • Go to the publication directory, until you can access the selected web server;
  • And the most important thing is the “Publish standard OData interface” checkbox!

After clicking on the “Publish” button, a default.vrd file will be created in the configured path (an XML file containing the data you created in the configured publications), and a record of your publication will be added to the web server I am here with you 'yam, what you ordered. After publishing, change the web server.

Dekilka respect for this publication. If you have a number of databases before publishing, then each of them will have its own catalog. Just think about the customer who is going to deny access to the base - he will have a necessary role and use Latin letters without special characters (if you want to fight with codes, you can earn Russian ones with spaces). If you are running on Windows and have UAC enabled, then before publishing, run the configurator as an administrator. If you work on Linux, you'll be fine, we'll tell you! :)

The axis looks like the working default.vrd from publishing to the OData interface:

As you can see from the publication file, the web server has absolutely nothing to do with the fact that it is physically necessary to find the information base, and then register it in the same way as you would register it in the list of databases of the cob window. The goal is to ensure that expanded access is installed on one computer with the web server and that the local database is at least physically accessible to the web server service with change rights. There may also be problems with the license being revoked and you will need to dig into the nethasp.ini file, in addition to all standard procedures. initial installation platforms.

After you have terminated the publication and restarted the server, you can check the results in the browser. To do this, you need to enter the name of the web server, then the name of the publication base, and then /odata/standard.odata/ . You must ask for a password and you will get something similar to this:

To demonstrate the capabilities of the technology, which is seen in the statistics, I took the "Trade Management (Basic)" configuration, edition 10.3, in which mode was set to "Version 8.2.13" and all metadata is available to the user via the REST interface, and click functions Install Warehouse Standard OData Interface () to ensure the availability of the warehouse is blocked.

If you have completed trading 10.3, and you have installed the volume mode "Version 8.3.5" or more, or if you have more current configurations, then all metadata will be received and you will need Let's quickly use a special format to add visibility to the necessary data. Instead of wasting an hour on the creation of your work, you can quickly follow my work, which is suitable for both basic and ceramic interfaces (div. insert).

Burchannya...

To be honest, I don’t even understand this idea with a customized list of metadata. It seems like a half-hearted decision. If the purpose was to increase security, then why should the data that is allowed be immediately given new access to editing and editing, rather than earning more? finely tuned rights due to the possibility of deprivation of reading? You can initially assign rights to a specially configured role, but only modify the application solution, and in this case I will not allow anyone into the database via the REST interface except server scripts for your site ( back-end), which decision will be made give, and what not.

Since they wanted to minimize the amount of information that is transmitted, it is an even more dubious decision - the metadata must be processed several times to develop functionality and then work with the data. Would it be logical to optimize the data itself? It would also be possible to enclose the list of field objects being queried, and it is especially important to enclose the information that is revealed behind the $expand parameter, which would include the entire associated object, in the event that we need one or two fields from each other.

What's next?

I think I can say hello to you - you have everything sorted out and working! What kind of crumbs are they? All this is due to the fact that you will need to organize access to the database - to exchange information with the corporate website, to operate the mobile app, to communicate with corporate software.

If you need to work on the site for a customer account type with the given history of mutual frosts, prices for personal discounts, introduction of agreements and other goodies, then our services have a number of ready-made libraries on the official website. And use the entire OpenUI5 framework from SAP, which, based on data captured by the OData protocol, allows you to create valuable business benefits. Zagalom rozdoll for a competent JS programmer.

Warning about "bicycles"

Chantly, after reading the rest of the phrase, your eyes might glaze over - “By hell, standard 1C web client! With such capabilities, the power interface to the base is compatible with blackjack and the receiving company.” But I am in no hurry to compete in this field with the 1C company, as it turns out that web developers are already doing a lot of things that we all know after the fact. Do you really want to repeat the great glory of the Dominican project?

The creators and risks may cost the effort and the resulting products may be ready for commercial use. Windows software developers here often like to boast that their development is worthwhile with clients for the future. And I am very grateful for them - the boys have found their niche. Aside from these articles, I have formed an opinion that this metadata.js complex is a web analogue of the “Extension for small computers” program of the DISCO company, which gave the ability to basic 1C programs to write add-ons ID smartphones. What is the program? 1C itself provided this very functionality for developing mobile solutions (and even richer ones, and for more platforms) without any cost as part of the development of its platform.

Z special notice. Due to the fact that the 1C web client cannot work like that, my current company decided to create a powerful alternative web interface. We hired a bunch of JavaScript developers, took as a basis for the front-end a popular library of interfaces with rich grids and charts, and chose node.js for the server. For this project, I implemented a SOAP interface for accessing data (there were no HTTP services yet), and we took the form of lists of registrations in just a few years. I don’t know exactly what the developer had there, but after many months of heroic battle against the all-out attack of bugs, the project was closed and the developers said goodbye. And the company's 1C program did not sit with clasped hands at this hour, but released a number of updates, after which using the standard web client became a little more convenient.

It is acceptable that we are not literate in JS programs, but would like to put some kind of list on the site. I have opened an article with a selection of the most popular libraries today, created a table and know a simple jsGrid library just for our appearance. Going to their site, we take the example of their code from the OData wiki and paste it there to our data.

In order to be lazy and not program anything for our application, it is necessary to request a full nameplate without having to send string statements. The standard UT10.3 doesn’t have much of a choice, so I’ll take the Contractor’s agent.

Now it's time. How can we formulate a sequence for reading the data we need? It's simple! We marvel at our path to the root OData (for less) as this guide is correctly called - Catalog_Counterparties. Then open the new window to the address http://localhost/DemoTrdBase/odata/standard.odata/Catalog_CounterpartiesWe prefer to use XML format instead of all documents. However, our example requires JSON and therefore we need to add a parameter:$format=json - view http://localhost/DemoTrdBase/odata/standard.odata/Catalog_Counterparties? $format=json . So, the groups don’t matter to us and let’s take them away using an additional filtering parameter:$filter=IsFolder eq false - view http://localhost/DemoTrdBase/odata/standard.odata/Catalog_Counterparties? $format=json & $filter=IsFolder eq false . The block of parameters, as you have already noted, begins with the symbol “?”, and the parameters themselves are connected to each other by the symbol “&”. New list available parameters and functions of the div. See the platform documentation.

The file is placed in the directory that is the root of your web server. It is necessary that the “domain” of the page and the requested data be saved, otherwise you will see a continuous update indicator and correction in the logs: "No "Access-Control-Allow-Origin" information is present on the requested resource. Origin "null" is thefore no allowed access. Confirmation had HTTP status code 401. "


Literally a few hours wasted and we already have a decent sign that is automatically marked on the side. The little bits look indestructible and you will need to ask for authentication and, so as not to enter your login and password right away, I have written them down in the access row. The final file of yours is simple and can be easily repeated, but about any problem I will also place it in the deposit box.

What about without programming?

Site, mobile add-ons, let us inform you that these other words sound cool for any IT specialist, but do not find favor in the hearts of high-ranking bosses. Their main working tool is Excel, which stinks to irrational workers due to the presence of a heavy subsystem of information from their 1C databases. And at this point, we understand that the Microsoft company itself saw the OData standard and introduced it into its programs starting with Office 2010. In office programs, we can either simply look at tables with data or quickly use query mechanisms to remove all of the information at one time without there is no need to connect tables from different arches.

For example, we are being bullied by the fighters. In UT10, we can remove from the virtual table of surpluses in the register the accumulation of mutual frosts by counterparties by clicking on the filter so that the amount of the balance is greater than zero (otherwise the price of the advance). I won’t set the date, so I won’t cite current data. For my base there will be a new message: http://localhost/DemoTrdBase/odata/standard.odata/AccumulationRegister_Frost exchanges with counterparties/Balance?$filter=AmountBalance gt 0

Having looked at the result, we can note that we cannot display for counterparties, but only keys for the counterparty advisor table. Well, please ask and this additional data. For this quick send without filters: http://localhost/DemoTrdBase/odata/standard.odata/Catalog_Counterparties

And now the sequence of cuts is simple:

  1. Open Excel (I have version 2016; if you have 2010 or 2013, the menu may be slightly different)
  2. Let's move on to the navigation path: “Dani” / “Create a post” / “From other sources” / “From the ODATA channel”.
  3. We indicate our submission to the register of mutual frosts
  4. On the authorization form, select the third option “Basic” and enter your login/password. We press "Connect".
  5. In the editor's window I will ask what has appeared, instead of the name "Request1" there is something more useful for us - "Frosts"
  6. In the center of the editor window there will be a column “List”, with the word “Record” in each row. We can either quickly use the contextual command “To Table” or click on the top button in the “Create” menu of the editor. When asked, answer “Ok”.
  7. Now the column is called Column1 and a button with arrows on different sides has appeared next to it. Press on it. A description of the existing columns will be pulled from the server. Uncheck all the checkboxes and clear them only in the “Account_Key” and “Amount Balance” columns. Click on “Ok” and a table with two selected columns with the required data will appear.
  8. Behind the borders of our respect, such things as organization, agreements and legal acts, or all of them were requested, were lost. As a result, we immediately have rows of counterparties with varying sums. They can be used for additional grouping. For either menu or context, click the “Group for” command. In group fields, leave out the counterparty, and delete the field from the sum. Name new column“Obov’yazok”, in the operation select “Amount”, and in the option enter the field of our amount. Click “Ok” and as a result, three fewer entries will be removed.
  9. Now we need to decrypt the counterparties. For this, in the left panel “Entry”, which already has the current entry “Interfrost”, select context not menu Then select “New request” / “More devices” / “ODATA channel”. At the end, we will probably go to the contractor's agent. Next, enter the authorization login/password again, and then press “Ok” and set the new entry to the name “Counterparties”.
  10. Let's go back to the "Frost" option (click on the name on the search bar).
  11. Now we are concluding the union of our two drinks. To do this, in the main menu of the editor, select “Combine” / “Combine”. The designer window will have our frost-freeze table. In the center of the window, select the entry “Counterparties”. The look of the home is deprived of the one behind the mind (from the outside). Then, by clicking, you select the washbasin stops. We'll get along with everything we've been given to demonstrate.
  12. After completing the above, we selected a new column “Counterparties” with a familiar button with different straight arrows. Click on this button and select the columns to enter. For interest, select “Name Outside” and “Parent” (group). The "Parent" column also tells us to open up - select the "Description" field in it (the original name of the agent).
  13. Zrobimo garno. The first column with the counterparty key can be deleted. The group column will be called “Group”, the columns with the counterparty’s names will be called “Counterparties”, and the borg column will be moved to the end of the table, which will be deleted.
  14. Now we can press the editor's main button - "Close and Enlarge".
  15. You can then view the selected table as data for the table and diagrams. Or, with the creation of new objects, it is clear that as a result of these data, our phrase is “Interfrost”.

Ale, as it seems, it’s better to drink once, almost a hundred times. I tried to record this sequence of actions on video. And I immediately anticipate that when you repeat, there will be a little bit wrong - you will be asked for authorization, which is what I guessed about. It’s just that at the time I record the video, Excel has already forgotten my login and password.

Pouches

I believe that my statue was cinnamon. I told about the birth and achievements new technologies platforms. Also, having clearly explained the setup of access to the information base using the OData protocol and navigating a number of applications of a practical wiki.

If there were no advance, access to OData can be limited to ceramic interface on remaining versions platforms, as a training example, by selecting the demo configuration base "Trade Management (Basic), Rev. 10.3" as a total of 8.2. Based on this configuration, any number of mouse clicks can be selected in Excel books current data for the Borg and this way it would be easy to remove current surpluses in warehouses, sales data and other relevant information.

P.S. A continuation of this article, which examines the operation of creating and changing data, was published at

Druk (Ctrl+P)

You can marvel at another part

Zagalnye Vidomosti

In platform version 8.3.5.1068 , published in the spring of 2015, a mechanism for integrating 1C with external programs through technology appeared REST interface. As an access protocol, the Vikorist platform uses the OData protocol. This is an open web protocol for retrieving and updating data. Vіn allows you to operate with data, like asking HTTP commands. In version 8.3.5.1068 it was no longer possible to remove sub-videos from the format Atom/XML . However, starting with the release of 8.3.8.1652 in September 2017. Another option has appeared for extracting data from the JSON format (JavaScript Object Notation) . Adapted from XML, it is easy to read by people and takes up less space. Moreover, all browsers have built-in features for working with JSON.

Working with the OData protocol on the 1C platform: business can be viewed in the book 1C: Developer's aids in section 17 Mechanisms of Internet services, paragraph 17.2.1 Standard OData interface. You can also look at the application of advanced support for the OData protocol,

Perevaga vikoristannya REST interface. This means that in order to revoke access to system data from the current state, there is no need to modify the code of the application solution (for example, if the application solution is on hold). To deny such access, it is necessary to publish the program on a web server in a special way and specify which configuration objects will be modified in this way. After this, third-party systems can access your program using additional HTTP requests.

Publishing to the standard OData interface follows the additional publishing dialog on the web server (Administration – Publishing to web servers) and is described in the book 1C:Enterprise 8.3. "Kerivnitstvo of the administrator."
Important! In order for configuration objects to become accessible through the standard OData interface, it is necessary to enable the global context using this method. SetWarehouse to StandardInterfaceOData().
The mechanism for installing a warehouse of objects available through the standard OData interface can be found in the following view: external processing. For this purpose it is not necessary to modify the application solution.

For interaction with an external REST web server from 1C:Enterprises, the features of work with HTTP are clearly visible in the platform: objects HTTPSend, HTTPSend and HTTPSend.

In this series of articles I will show examples of typical operations that are used in this type of HTTP method;

  • Taking tributes - method GET;
  • Creation of an object - method POST;
  • Data update: method PATCH– in whose case one can deprive one of the power that is required to be restored; method PUT- In whose case it is necessary to point out all the powers of reality;
  • Vidalennya tributes - method DELETE.

1. Apply the grip. HTTP GET method

How the server is available is published on the web server of the database with names WebBuh(Demo database "Business Accounting 3.0"). As a data exchange format, I use the JSON format. A report about working with JSON is written in the documentation available. To retrieve data from the server using the HTTP GET method, you need to create an object ReaderJSON for sequential reading of JSON data from a file or row. To organize sequential recording of objects and texts on the server using the HTTP POST PATCH PUT method, you need to create an object JSON record.

Significantly, the DELETE method does not require JSON. As an illustration of streaming reading and writing JSON when converted to a REST interface, I will click on the correspondent function zagalnogo significance :

WiklikatiHTTPMethodOnServer // <Описание функции>&On the server - The order to place the name on the HTTP method for requesting ("POST", "PATCH", "PUT", "GET", "DELETE" // - HTTPSubject //<АдресРесурса>- A row of http-resources, until the HTTP request is sent.<ОтправляемыеДанные>//- The structure of either the data that is returned to the specified address for processing // to the server with the vicoristan assigned to the HTTP method "POST" or "PATCH" or "PUT" // The value that is rotated: // The structure of the server's view in contents in HTTPMethod // Function Dzvoniti NOT indicated)// Creation HTTP Request Headers = New View(); Headings. ("Content-Type", "application/json"); ZapitHTTP = New HTTPZapit ( ); AddressesResource, Headings// Record Json useful for creating and updating data If HTTPMethod = "POST" or HTTPMethod = "PATCH" or HTTPMethod = "PUT", then RecordJSON = New RecordJSON; ParameterJSON = New ParametersRecordsJSON(Line WrapJSON.Auto,"",True); JSON record., (JSON Parameters); ); // (JSON Parameters); WriteJSON(WriteJSON Data sent(); obov'yazkovi in ​​this case RowTila = RecordJSON.Close Request HTTP.Set TiloIzRows, (Row Tila, CodingText.UTF8 VikoristannyByteOrderMark.Nevikoristuvati ); KinetsYakscho; ; // Viklik Method HTTPZ'ednannya SendHTTP = HTTPConnect.ClickHTTPMethod(HTTPMethod, WriteHTTP) // Viklik Method HTTPZ'ednannya StructureTypes = New Structure;); .Insert("CodeStan", Submit HTTP.Code // Read JSON only for the GET method Yakshcho HTTPMethod = "GET" Todi Try JSON Reader = New JSON Reader ; ServerView = Submit HTTP.Remove Threaded Line ("UTF-8"); JSON reader. ;"Appearance =",ReadJSON(ReadJSON) ; ,True); StructureView.Insert( ViewServer Appearance StructureTypes; .Insert(" Server Version Not Decryption // Viklik Method HTTPZ'ednannya ", Server Report); Blames Show(DescribeMilk())

Turned Undesignated; KinetsProby; Concession; Turn around ; EndFunctions

// Wiklikati HTTPMethodOnServer() To extract the server view from the JSON format when downloading the application solution to the REST interface, you need to specify the resource address $format=json. ; Or the MIME type WebBuh"application/json" at the title:" Headers = New View(); Headers.Insert("Content-Type",;

"application/json") ResourceAddress = "

  • If the value of another parameter is set to True, read object JSON will be viconano in Appearance.If False is installed, the objects will be read into the object type Structure.
  • When deserializing JSON objects from a structure, it is necessary to remember the functions up to the keys of the structure. If, when deserializing an object, it is found that it has a power that is unacceptable for the structure key, blame will be raised.

1. 1 Configuring HTTP connection parameters

To organize the client part of interaction with the external REST web server, I created a client configuration based on the BSP from scratch. In this configuration, I created a connection parameters wizard (div. Fig. 1)

Fig. 1 Configurator for setting up HTTP parameters connecting to external IB via the rest interface

After pressing the button Check the server's message, A procedure is called in which the client tries to cancel the server's response. Program code The procedure is written below:

&OnClients Procedure VerifyConnections(Command) Addresses = Object.ServerAddress; Koristuvac = Object.Koristuvach ; Password = Object.Password; Im'yaBazi =<>Object. Name; Port =?(Object. Port 0, Object. Port, 80) "; ; ,True); HTTPZ'ednannya = New HTTPZ'ednannya(Addresses,Port,Koristuvach, Password); ResourceAddress = Im'yaBasi + "/odata/standard.odata/) $metadata // Viklik Method HTTPZ'ednannya <> //Viklik functions koristuvach = B; ClickHTTPMethodOn Server

("GET", HTTPZ'ednannya,AddressResource; Yakshcho
Unidentified Todi ZagalnyAppointmentClientServer.NotifyKoristuvach("StanCode "+StructureType.StanCode) Concession; KinetsProcedures
The purpose of this procedure is
checking the robot service =Check the connection parameters correctly. For this it is sufficient to use the GET command:+ HTTPZ'ednannya.ViklikatiHTTPMethod( “;
"GET"
, RequestHTTP);
From wiki address and resource: Addressresource Im'yaBazi
/odata/standard.odata/ You can also check the robot service using a browser using Wikorist URL http://host/WebBuh/odata/standard.odata. The legacy of such a request is simply a list of essentials. For taking off I'll describe everything
standard OData interface (list of available entities, their attributes and functions in XML form document.) it is necessary to enter a GET-query from the wiki parameters$metadata.

  • 100-199 - Information lines that indicate that the client’s request has been accepted and is processed.
  • 200-299 – means that the client’s request has been successfully processed.
  • 300-399 means that the request is not signed in and the client needs to take action to be satisfied with the request.
  • 400-499 – informs about amendments on the side of client programs. These codes may indicate that additional information is being retrieved from the client.
  • 500-599 – informs about the strike on the server side, indicating that the server has encountered the strike and, obviously, cannot sign out the client.

1.2 Search for an object using an identifier

This function is designed to search for an advisor or document using a unique identifier on the server. Once the object is found, the function rotates the row values ​​of the identifier (Ref_Key), otherwise rotates NOT indicated. The function passes the following parameters:

  • HTTPZ'ednannya – Object of type HTTPZ'ednannya
  • Publication Name – Name of the published server database
  • Element – ​​identifier of the essence of an object, for example, Catalog_Organizations or Document_ is the witness of the Organization.
  • Identifier – Identifier of the object that needs to be searched on the server, for example, Organization.UniqueIdentifier()
&On the Server Function SearchObjectByGUID (HTTP Connection, Publication Name, Element, Unique Identifier) GUID = Row(UniqueIdentifier); // Rearranged in a row to the Addressresource = + Element+ "(guid""+ GUID+ "")?$format=json" ; ,True); = BHTTPZ'ednannya(Addresses,Port,Koristuvach, Password)("GET" , ResourceAddress = Im'yaBasi + "/odata/standard.odata/) $metadata ,True); .CodeStanu >= 400 Todi //Game of SignificanceClientServer.Notify Koristuvachev (Element+ "Repair" +Structure of the Type.Code+ //Game of Significance of the ClientServer.Show of to Koristuvach (Structure of the Type of Show.View of the Server aNotDecryption); Turned unintentionally; KinetsYakscho; Appearance = StructureTypes. VіdpovіdServer a; Array = Appearance["value"]; Yakshto Array = Unknown Todi Rotate View ["Ref_Key"] Otherwise Rotate Array ["Ref_Key"];

KinetsYakscho; EndFunctions Parameter

Addressresource Vykoristovuetsya for upgrading to REST service. To check the robot service, you can specify the resource in the browser in this way

  • http://(WebServer Address)/(Publication Name)/odata/standard.odata/(Element)?(Parameters) de
  • WebServer Addresses– Addresses of the web server on which the service is published, for example Localhost Name of Publication- I'm
  • HTTPZ'ednannya.ViklikatiHTTPMethod( information base
  • assigned at the time of publication of the decision – Upgrade to standard OData interface
  • element- Resource parameters. For example, for the selection accepted for HTTP requests: ?key=value&key2=value2

1.3 Search for an object using search fields

The next function of the koristuvach is intended for searching for an object in the search fields in the event that the object is in ID number. The function locks the row Ref_Key –Identification number.

&On the Server Function P searchObjectFieldsSearch(HTTPPublication,PublicationName,Element,FieldsSearch) Umova = ""; For the skin Key Significance of the Field Search Cycle Umova = Umova + KeyMeaning.Key+ "eq"" + KeyValue.+ "" and "; KіnetsCycle; Text to Zapitu =Lev(Umova, StrLina(Umova)-5); // the remaining 5 characters are deleted Addressresource= Publication name+ "/odata/standard.odata/" +Element+ "?$filter=" + Text to Zapitu+ "&$format=json& $select=Ref_Key" ; //Wikk my koristuvalnik function // Viklik Method HTTPZ'ednannya= Wiklikati HTTPMethodOnServer( "GET",HTTPZ'ednannya,AddressResource); Submit HTTP.Code // Viklik Method HTTPZ'ednannya .CodeStanu >= 400 Todi / / General purpose Client Server. Povіdomity Koristuvachevi (Element + "Pomilka" + Structure Vіdpovidі. Code Stan); //Other AssignmentClientServer.Inform Koristuvachevi(ViewStructure.NonDecryptionServerType); The turn is unimportant; KinetsYakscho; Appearance = StructureTypes. VіdpovіdServer a; Array = Appearance["value" ]; Yakshto Array = Unknown Todi Rotate View ["Ref_Key"] Otherwise Rotate Array ["Ref_Key"];

KinetsYakscho; EndFunctions As can be seen from the procedure PSearchObjectFieldsSearch, the selection starts with a keyword$filterat the resource address. Formal parameterFieldsPoshku –

This is the same as the name and meaning of the details.

  • It is important that the naming of details is obvious. It is necessary to remember that for witnesses:
  • Code - code,
  • Description – Name
  • DeletionMark – visible icon,
  • IsFolder – group sign,
  • Parent_Key – father.

In order to indicate the type of message, add the suffix _Key to the name of the message, for example, Contractor_Key.

  • For documents:
  • Number – document number,

Date – document date.

  • Logical selection operations
  • eq - Rivne; /Catalog_Location?$filter=Name eq 'Golovny';
  • ne - Not equal; /Catalog_Location?$filter=Name ne 'Perm'; gt – more;/Catalog_Products?$filter=
  • Price gt 10;
  • ge - More or one; /Catalog_Products?$filter=Price ge 10;
  • lt - less; /Catalog_Products?$filter=Price lt 10;
  • le - less or one; /Catalog_Products?$filter=Price le 10;
  • or - Logical ABO; /Catalog_ Products ?$filter= Price lt 10 or Price gt 100;
  • not - crossed; /Catalog_ Products ?$filter=not (Price eq 10);

It is also significant that the value of the actual parameter assigned at the time of publication of the decision(or essence)), which I pass to the function follows the following rule:

Prefix_Image_ObjectConfiguration_Suffix_Image.

In addition to the standard OData interface, you can gain access to such objects ( PrefixName):

  • Dovidnik – Catalog;
  • Document – ​​Document;
  • Document Journal – DocumentJournal;
  • Constant – Constant;
  • Exchange plan – ExchangePlan;
  • Account plan - ChartOfAccounts
  • Plan of types of expansion - ChartOfCalculationTypes;
  • Chart of characteristics types - ChartOfCharacteristicTypes;
  • Register of information - InformationRegister;
  • Accumulation register – AccumulationRegister;
  • Registration register - CalculationRegister;
  • Accounting register - AccountingRegister;
  • Business process - BusinessProcess;
  • Zavdannya – Task.

Object NameConfiguration- The power of the “name” of the configuration object is as specified in the configurator.

SuffixNames- necessary clarification of the resource name, required, can take the following values:

  • Names of the tabular part of the object;
  • The name of the object's virtual table;
  • RowType - row of the tabular part of the object;
  • RecordType – the last entry to the register.

Resource management parameters

After forming a name for the resource, you need to select the parameters for the resource, for example, ?$filter= Significance &$format=json& $select= Ref_Key ,

  • , the selection starts with a keyword- select when deleting data
  • $format- specify the format of the data to be rotated,
  • $select- re-interpretation of the powers of reality, which will lead to the result of washing down;
  • $metadata- converts the description of the standard OData interface (it is displayed without inserting the name suffix, but on one of the images above);
  • $top- exchange the number of records that can be rotated;
  • $skip- selects the specified number of records from the result;
  • $count- Rotates the number of records in a selection;
  • $inlinecount=allpage(=none)- provides the result with information about the number of records
  • $orderby=<Реквизит1>asc,<Реквизит2>desc- Sorting the results
  • allowOnly- Only allowed (viskorist without the “$” sign).

1.4 Retrieve an array of entries in the information register

It is possible to extract an array of records from the personal data register of individuals, for example, the history of changes in personal income of an individual

Name of Publication = "WebBuh"; Element = "InformationRegister_FIOPHYSICAL Appearance"; Period = Undefined; Tribute to PosilalnogoType= new structure(); D AnyPositiveType.Insert("PhysicalIdentity",PhysicalIdentity_Key); DanіNESilkovogoType= new structure(); DanіNESilkovogoType.Insert("PhysicalObject_Type", "StandardODATA.Catalog_PhysicalObject") Array = Retrieve ViewRegistryRecord(HTTP Posting , Publication Name , Element , Period , Vimiryuvannya PosilalnogoType, Vimirvannya NON-Silkovy Type)

The purpose of the function is to select the Dial Record of the View Register that is clicked in the application shown below.

&On the Server Function Cancel DialVideoRegister Entries(HTTP Publication , Publication Name , Item , Period = Unspecified , Vimiryuvannya PosilalnogoType= Unspecified Vimirvannya NON-Silkovy Type= Unspecified) Text Zapitu = ""; What period<>Unidentified Todi Formatting period= Format (Period "DF=yyyy-MM-ddTHH:mm:ss"); Text Zapitu = "Period = datetime"" + FormattingPeriod + """ ; KinetsYakscho; Vimiryuvannya PosilalnogoType <>Yakshcho Vimiryuvannya PosilalnogoType Unknown Todi For the Skin KeySignificance Cycle Power = ? (SignificanceReserved (Text to Zapit), ",",""); Zapitou Text = Zapitou Text KeyMeaning.Key+ Asking + KeyValue.+ "=guid(""+ Vimirvannya NON-Silkovy Type<> //Viklik functions koristuvach+ "")"; End of Cycle; End of Yakshcho; Yakshcho Vimirvannya NON-Silkovy Type For the skin KeySignificance Cycle Cycle Power = ? ( SignificanceReserved Asked =? ( Zapitou Text = Zapitou Text + Zapit + Until + "=" + KeyValue. KeyMeaning.Key ; KіnetsCycle; KinetsYakscho; Resource Addresses = Publication Name + " /odata/standard.odata/" + "+ Element + "("+ Text Zapitu +"; //Wikk my koristuvalnik function // Viklik Method HTTPZ'ednannya = zagalnogo significance) ?$format=json // Viklik Method HTTPZ'ednannya("GET", HTTP Connection, Resource Addresses); Yakshcho.CodeStanu >= 400 Todi / / General purpose Client Server. Povіdomity Koristuvachevi (Element + "Pomilka" + Structure Vіdpovidі. Code Stan); //Other AssignmentClientServer.Inform Koristuvachevi(ViewStructure.Non-DecryptionServerType); 0

The turn is unimportant; KinetsYakscho;

Appearance = In 1C:Enterprise, starting with version 8.3.5, the platform can automatically generate a REST interface for all configurations. It works with the OData protocol and allows you to process agents, documents and registers through a web server. It is possible to quickly remove data by several orders of magnitude, lower through COM or files that cannot be kept quiet. For

  • various operations
  • vikorystivuyutsya slaughter:
  • GET – retrieves data from Vikorist;
  • POST - vikorist for creating objects;

PATCH – modification of an explicit object;

  • Dovidnik – Catalog;
  • Document – ​​Document;
  • Document Journal – DocumentJournal;
  • Constant – Constant;
  • Exchange plan – ExchangePlan;
  • Account plan - ChartOfAccounts
  • Plan of types of expansion - ChartOfCalculationTypes;
  • Chart of characteristics types - ChartOfCharacteristicTypes;
  • Register of information - InformationRegister;
  • Accumulation register – AccumulationRegister;
  • Registration register - CalculationRegister;
  • Accounting register - AccountingRegister;
  • Business process - BusinessProcess;
  • Zavdannya – Task.

DELETE – deleted object.

  • To access other objects, the following prefixes are used:
  • The ODATA protocol can be modified by introducing object methods, followed by POST requests.
  • For a document – ​​Post() and Unpost();
  • For the task manager – ExecuteTask();
  • For a business process - Start ();
  • For the data register – SliceLast() and SliceFirst();<ИмяПерерасчета>For the accumulation register and accounting register – Balance(), Turnovers() and BalanceAndTurnovers();<Имя базового регистра расчета>().

To start using this interface, you need to publish it. Go through the configurator menu "Administration" - "Publish on a web server", check the box "Publish standard OData interface" and click "Publish".

After publication, the robot protocol can be verified at http://<ИмяСервера>/<ИмяБазы>/odata/standard.odata. At the same time, we can select the entire warehouse of published tables. Vin may look like a smaller baby.


If, after publishing the REST interface, the published data warehouse is empty, you need to quickly install the Standard OData Interface Warehouse method. At the input there is 1 parameter of the “array” type. The array needs to add metadata that needs to be published.

Warehouse = new Massiv;
Warehouse.Add(Metadata.Dovidniki.Counterparties);
Install Warehouse Standard OData Interface (Warehouse);

http://<ИмяСервера>/<ИмяБазы><ИмяСправочника>

When recording, you can select the following parameters:

select – this parameter has required fields;

format—specify the format in which we want to output the report (XML or JSON), based on XML

odata – if we don’t need a metadata description for the species, then we write “odata=nometadata”

filter – selection is indicated here.

As I wrote above, we can remove evidence from two XML formats or JSON, XML is used by promies. To extract data from JSON format, you need to URL address Add “?$format=application/json”.

http://<ИмяСервера>/<ИмяБазы>/odata/standard.odata/Catalog_<ИмяСправочника>?$format=application/json

Here we need to isolate a specific element of the evidence, and not all of its entries. For whom is the vikorist's charming word "filter".

http://<ИмяСервера>/<ИмяБазы>/odata/standard.odata/Catalog_<ИмяСправочника>?$format=application/json&$filter=Ref_Key eq guid’UID’

If you realize that the URL contains two parameters: $format and $filter, they can be arranged in any order, but before the first parameter there is a sign “ ? "and before the other" & “. The logic here is this: we indicate the address of the agent in the first part, and the parameters in the other. These parts are indicated by the sign “ ? ", and the axis parameters themselves are divided by the sign " & “. If you think about it schematically, it looks like this

AddressesTables ? $Parameter1=Value of Parameter1 & $Parameter2=Parameter2Value