5 Replies Latest reply on Jun 5, 2020 7:54 AM by Amit Bhartiya

    Asset count across all resources in EDC

    Amit Bhartiya Guru

      Hi All,

      I am working on EDC version 10.2.2.
      I need to build a report which has all the asset counts across all the resources in EDC.

      For example-

      Resources-10
      tables-1000
      Views-500
      column-223536646
      Trigger-100
      Procedure-23464

      and so on for all the resources.
      So far i know one API which will give me the count of all the resources:

      http://svm3423pdv.dev.crab.com:9085/access/2/catalog/data/objects?q=core.classType%3Acore.Resource&offset=0&pageSize=20&includeSrcLinks=true&includeDstLinks=true

       

      Does anyone have any idea on how this can be achieved?

       

      Thanks,
      AB

        • 1. Re: Asset count across all resources in EDC
          Darren Wrigley Guru

          the best way to do this is to use search with a facet for classtype - 2/catalog/data/search.

          e.g.

           

           

          http[s]:[server]:[port]/access/2/catalog/data/search?q=*&facet=true&defaultFacets=false&facetId=core.classType&highlight=false&offset=0&pageSize=1&enableLegacySearch=false

           

          that will do the following:-

          - set a facet for core.classType only (no other facets)

          - return only 1 object - since the facet result is all you need (and you can't return 0 objects)

           

          you can get the counts from the facetResults - for the facetId core.classType - it will count all instances for each classtype that has at least 1 instance.  you can disregard the core superclasses like core.DataElement & core.DataSet

           

          {

            "metadata": {

              "totalCount": 512694

            },

            "facetResults": [

              {

                "facetHref": "/2/catalog/models/facets/fieldFacets/core~2e~classType",

                "facetId": "core.classType",

                "facetType": "FieldFacet",

                "groupLabel": "Asset Type",

                "buckets": [

                  {

                    "fq": "{!tag=all_class_type}core.allclassTypes:\"core.DataElement\"",

                    "value": "core.DataElement",

                    "count": 431879

                  },

                  {

                    "fq": "{!tag=all_class_type}core.allclassTypes:\"com.infa.ldm.cognos.DataAttribute\"",

                    "value": "com.infa.ldm.cognos.DataAttribute",

                    "count": 94612

                  },

                  {

                    "fq": "{!tag=all_class_type}core.allclassTypes:\"com.infa.ldm.cognos.FieldBody\"",

                    "value": "com.infa.ldm.cognos.FieldBody",

                    "count": 94559

                  },

                  {

                    "fq": "{!tag=all_class_type}core.allclassTypes:\"com.infa.ldm.relational.Column\"",

                    "value": "com.infa.ldm.relational.Column",

                    "count": 91751

                  },

                  {

                    "fq": "{!tag=all_class_type}core.allclassTypes:\"com.infa.ldm.relational.ViewColumn\"",

                    "value": "com.infa.ldm.relational.ViewColumn",

                    "count": 51397

                  },

                   ...

              }

           

          ]

            }

            ],

            "hits": [

           

                ]

              }

            ],

            "hits": [

            ...

            ]

          }

          the other way (slower) is to use /access/1/catalog/eicstats - and look for CatalogSizeStats/CountOfObjectsByType in the xml results

          • 2. Re: Asset count across all resources in EDC
            Amit Bhartiya Guru

            Thanks Darren- I am not getting any response for the above endpoint.

             

            {

             

             

            {

             

             

            "totalCount": 0

             

             

            },

             

             

            [],

             

             

            []

             

             

            }

             

            Is there anything i am missing?
            • 3. Re: Asset count across all resources in EDC
              Amit Bhartiya Guru

              Is Faceting not enabled?
              How can i check that?
              How can i get that enabled?


              • 4. Re: Asset count across all resources in EDC
                Darren Wrigley Guru

                I ran a test using 10.2.2hf1 sp1 - i don't have access easily to versions older than that.

                 

                you can try using default facets and not the specific core.classType facet.  you can also use /1 version of search.

                • 5. Re: Asset count across all resources in EDC
                  Amit Bhartiya Guru

                  Hi Darren-- Thanks for your suggestion it worked with default facet =true and /2 version.
                  I was also able to get the response from eicstats which took some time to fetch the results as mentioned by you!!



                  Thanks a ton!!