Publishing standard REST API for your infobase


To provide the standard REST API for your infobase, perform the following:

  1. Install and configure a web server (Apache or IIS).
  1. Run the Designer for your infobase on behalf of Administrator and initiate publishing your infobase to the web server:

    1.jpg

  1. Enable publishing the standard OData interface and finally click Publish.

    2.jpg

  1. In the web browser, open the http://localhost/<InfobaseName>/odata/standard.odata/ link

    3.jpg

  1. Investigate the list of objects that are accessible via the OData interface.

    4.jpg

If you need to add other objects to the list:

  • In Designer mode, open the attached SetODataObjects.epf data processor and specify these objects in the AddToOdataAtServer() method.
  • In Enterprise mode, run the modified SetODataObjects.epf data processor.
  • Re-publish the infobase to the web server.
    • Also, you might need to restart the web server.
  1. Use the following HTTP-methods for various operations with data:
  • Receive object data—GET;
  • Create an object—POST;
  • Update object data—PATCH/PUT (depending on the number of object properties to update);
  • Delete an object—DELETE.

For instance:

To create a new object, use a POST request whose Ref_Key property’s value is set to null GUID.

To create an object and modify its properties, specify their values in the request body in XML format (here is the full request body sample):

POST  /OData_Tests_Infobase/odata/standard.odata/Catalog_Goods HTTP/1.1
Content-Type: application/atom+xml
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
User-Agent: 1C-Enterprise
Host: test-host:8090
Content-Length: 1610
<?xml  version="1.0" encoding="utf-8"?>
<entry  xmlns=http://www.w3.org/2005/Atom
  xmlns:d=http://schemas.microsoft.com/ado/2007/08/dataservices
  xmlns:m=http://schemas.microsoft.com/ado/2007/08/dataservices/metadata
        xmlns:georss=http://www.georss.org/georss
        xmlns:gml=http://www.opengis.net/gml>
  <category term="EnterpriseV8.CatalogGoods"  scheme=http://schemas.microsoft.com/ado/2007/08/dataservices/scheme
  />
   <id />
   <title />
   <updated>2013-08-12T11:48:25Z</updated>
   <author>
      <name />
   </author>
   <content type="application/xml">
      <m:properties>
         <d:Code>157</d:Code>
         <d:DeletionMark>false</d:DeletionMark>
<d:Description>Майка синяя</d:Description>
         <d:IsFolder>false</d:IsFolder>
         <d:Parent_Key m:null="true" />
  <d:Ref_Key m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:Ref_Key>
         <d:Артикул m:null="true" />
  <d:Поставщик_Key>F400322D-7AE8-4803-A7BE-0D80E525E8C2</d:Поставщик_Key>
      </m:properties>
   </content>
</entry>
   <author>
      <name />
   </author>
   <content type="application/xml">
      <m:properties>
         <d:Code>157</d:Code>
         <d:DeletionMark>false</d:DeletionMark>
<d:Description>Майка синяя</d:Description>
         <d:IsFolder>false</d:IsFolder>
         <d:Parent_Key m:null="true" />
  <d:Ref_Key m:type="Edm.Guid">00000000-0000-0000-0000-000000000000</d:Ref_Key>
         <d:Артикул m:null="true" />
  <d:Поставщик_Key>F400322D-7AE8-4803-A7BE-0D80E525E8C2</d:Поставщик_Key>
      </m:properties>
   </content>
</entry>

To modify existing objects, use a PATCH request. For example, to change the Goods catalog item specified by its GUID, use the following request:

PATCH /OData_Tests_Infobase/odata/standard.odata/Catalog_Goods(guid'7f4b5034-0331-11e3-b914-5404a6a68c42')

To delete existing objects, use a DELETE request. For example:

  DELETE /OData_Tests_Infobase/odata/standard.odata/Catalog_Goods(guid'7f4b5034-0331-11e3-b914-5404a6a68c42')

Later, we plan to implement the mark for deletion operation via a separate OData-operation.

 

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002