Generic Inquiry Access Through OData: To Sign In to MYOB Acumatica and Retrieve the Metadata

This activity will walk you through the process of signing in to MYOB Acumatica and retrieving the metadata when you use the generic inquiry–based OData interface.

Story

Suppose that you are a developer who needs to investigate the options available in MYOB Acumatica for integration with business intelligence (BI) applications. As a part of this task, you need to test the generic inquiry–based OData interface. To send requests to MYOB Acumatica through the generic inquiry–based OData interface, you need to sign in to MYOB Acumatica.

Process Overview

You will configure a Postman collection to use the basic authentication and retrieve the list of generic inquiries and their fields available through the generic inquiry-based OData interface to test the sign-in.

System Preparation

Before you begin performing this activity, do the following:

  1. Deploy an instance of MYOB Acumatica with the name MyStoreInstance and a tenant that has the MyStore name and contains the T100 data.
  2. Make sure that the Postman application is installed on your computer. To download and install Postman, follow the instructions on https://www.postman.com/downloads/.

Step 1: Signing In to MYOB Acumatica

To configure basic authorization in Postman for sign-in to MYOB Acumatica, do the following:
Tip: Instead of configuring the requests by yourself, you can import the Postman collection from the OData.postman_collection.json file, update the variable values, and test the corresponding requests from this collection.
  1. In Postman, create a new collection.
  2. On the Authorization tab of the collection, specify its authorization settings as follows:
    1. In the Type box, select the Basic Auth type.
    2. In the Username and Password boxes, type the credentials that you are using to access the MYOB Acumatica instance for the training course.
  3. Click Save.

Step 2: Retrieving the Metadata

To test the sign-in and retrieve the metadata, do the following:

  1. In the collection, add the following GET request to retrieve the list of generic inquiries exposed through OData.
    GET http://localhost/MyStoreInstance/t/MyStore/api/odata/gi/$metadata
  2. Send the request. The response of the successful request contains the 200 OK status code. The following code example shows a fragment of the response body.
    <edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
      <edmx:DataServices>
        <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" 
          Namespace="GenericInquiry">
          <EntityType Name="BILeadConversion">
            <Key>
              <PropertyRef Name="LeadID"/>
              <PropertyRef Name="OpportunityID"/>
              <PropertyRef Name="BusinessAccount"/>
              <PropertyRef Name="ContactID"/>
              <PropertyRef Name="NoteID"/>
              <PropertyRef Name="AddressID"/>
              <PropertyRef Name="LeadID_2"/>
            </Key>
            <Property Name="LeadID" Type="Edm.Int32"/>
            <Property Name="OpportunityID" Type="Edm.String"/>
            <Property Name="BusinessAccount" Type="Edm.String"/>
            <Property Name="Contact" Type="Edm.String"/>
            <Property Name="AccountName" Type="Edm.String"/>
            <Property Name="JobTitle" Type="Edm.String"/>
            ...
          </EntityType>
          ...
          <Function Name="DB-StorageDetails">
            <Parameter Name="Warehouse" Type="Edm.String"/>
            <ReturnType Type="Collection(GenericInquiry.DBStorageDetails)" 
              Nullable="false"/>
          </Function>
          ...
          <EntityContainer Name="Default">
            <EntitySet Name="BI-LeadConversion" 
              EntityType="GenericInquiry.BILeadConversion"/>
            <EntitySet Name="BI-Cases" 
              EntityType="GenericInquiry.BICases"/>
            <EntitySet Name="DB-StorageDetails" 
              EntityType="GenericInquiry.DBStorageDetails"/>
            <EntitySet Name="BI-ARInvoices" 
              EntityType="GenericInquiry.BIARInvoices"/>
            <EntitySet Name="BI-GLBudgetActual" 
              EntityType="GenericInquiry.BIGLBudgetActual"/>
            ...
            <FunctionImport Name="DBStorageDetails_WithParameters" 
              Function="GenericInquiry.DB-StorageDetails" 
              EntitySet="DB-StorageDetails"/>
            <FunctionImport Name="CRCampaignSalesOrders_WithParameters" 
              Function="GenericInquiry.CR-CampaignSalesOrders" 
              EntitySet="CR-CampaignSalesOrders"/>
            <FunctionImport Name="PMProjectSummary_WithParameters" 
              Function="GenericInquiry.PM-Project Summary" 
              EntitySet="PM-Project Summary"/>
            <FunctionImport 
              Name="DBStorageDetailsByItemWarehouseLocation_WithParameters" 
              Function="GenericInquiry.DB-StorageDetailsByItemWarehouseLocation" 
              EntitySet="DB-StorageDetailsByItemWarehouseLocation"/>
            <FunctionImport Name="CRCampaignInvoices_WithParameters" 
              Function="GenericInquiry.CR-CampaignInvoices" 
              EntitySet="CR-CampaignInvoices"/>
            ...
          </EntityContainer>
        </Schema>
      </edmx:DataServices>
    </edmx:Edmx>
  3. Save the request.