Adding Fields Using REST APIs

The object-admin service provides REST APIs for performing CRUD operations on object definitions, such as adding fields. Here you’ll use these APIs to add business and credit reference fields to the Distributor Application object.

  1. Download and unzip the resources for this exercise.

    curl https://resources.learn.liferay.com/courses/latest/en/application-development/modeling-data-structures/liferay-p6k3.zip -O
    
    unzip liferay-p6k3.zip
    

    This .zip file includes shell scripts that call the object-admin REST APIs.

  2. Navigate to liferay-p6k3/curl.

    cd liferay-p6k3/curl
    
  3. Run this script to create fields for storing business information:

    ./ObjectField_POST_BusinessDetails_ByExternalReferenceCode.sh
    
    Field NameType
    businessNameText
    businessWebsiteText
    businessEstablishedDateDate
    businessEmployeeNumberInteger
    businessAnnualRevenueText
    businessOtherBrandsOfferedLong Text
    businessPhoneNumberText
    businessAddressLineOneText
    businessAddressLineTwoText
    businessCityText
    businessStateProvinceRegionText
    businessZipPostalCodeText
    businessCountryText
    businessLicenseNumberText
    businessResaleNumberText
    businessTaxIDNumberText
    businessLicenseAttachment
    businessProofOfInsuranceAttachment
  4. Create fields for storing the business’s bank details:

    ./ObjectField_POST_BankDetails_ByExternalReferenceCode.sh
    
    Field NameType
    bankNameText
    bankAccountNumberText
    bankPhoneNumberText
    bankAddressLineOneText
    bankAddressLineTwoText
    bankCityText
    bankStateProvinceRegionText
    bankZIPPostalCodeText
    bankCountryText
  5. Create fields for receiving business reference details:

    ./ObjectField_POST_BusinessReference_ByExternalReferenceCode.sh
    
    Field NameType
    referenceSupplierNameText
    referencePhoneNumberText
    referenceAddressLineOneText
    referenceAddressLineTwoText
    referenceCityText
    referenceStateProvinceRegionText
    referenceZIPPostalCodeText
    referenceCountryText

When finished, the Distributor Application should have 48 fields.

The Distributor Application object should have 48 fields.

Great! These fields can help Delectable Bonsai collect the data they need for evaluating and vetting each applicant in compliance with KYC policies and AML laws.

Now the object definition needs to collect information to assess the business value of each potential partnership.

Next: Creating Picklists for Distributor Applications

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy