Currently, we (provider GES_DISC) use MMT → Manage CMR → Collection Permission → Selected Collections to hide/unhide collection from being searchable by public users. Can we use API to update collection's private/public property. How and can you provide us sample API commands.

  • No labels

6 Comments

  1. MMT uses ACLs to manage this. Have you had a chance to review the docs below? There are examples for the API usage in the documentation.

    If you need more explicit examples or more information, please reply here or contact us directly at cmr-support@earthdata.nasa.gov

  2. We already have ACL set up. I don't need to use API to modify any ACL. I have go through most of those documentation but can't find how to hide/unhide a collection API. Maybe I missed it.

    If you can pass me some explicit API examples on hide/unhide collection, it will be very appreciated. I have email Yonggang asking him that question but did not hear anything back yet. Maybe that is not his area. Thanks.  

  3. No, there is no API specifically for hiding/unhiding collections. This is done by modifying the ACL group, adding the collection to or removing the collection from your Selected Collections group, just as you have been doing with the MMT UI. We can get you an explicit example of managing the collection using the ACL update in the access-control API. Sorry for the delay in getting back to you; we will try to get you a safe working example ASAP next week.

  4. Yes, adding the collection to or removing the collection from Selected group using MMT UI is the exact thing that we are trying to replace with an API command. That will be perfect if you can get me some explicit examples of managing the collection using the access-control API. No hurry, take your time. 

    In the transition from EarthdataLogin to Launchpad authentication with CMR publication and MMT UI, GES DISC is testing and updating our software to use one service account Launchpad certificate instead of using each curator's EarthdataLogin. We would also like to eliminate the need for all curators to apply for their own CMR and MMT NAMS for using MMT to manage collections in the future. That is why I am searching for API and maybe combining with our service account Launchpad certificate for our curators to use in managing their collections. Many thanks. 

  5. Here are a few examples of query and update usage for the ACL (using a test ACL and collections I've set up in SIT):

    Reference: https://cmr.uat.earthdata.nasa.gov/access-control/site/docs/access-control/api.html

    You should be able to modify your ACL(s) similarly, changing the group _permissions and/or associated collections.

    Retrieve ACL

    $> curl -i -H "Echo-Token: $sit_token" "https://cmr.sit.earthdata.nasa.gov/access-control/acls/ACL1200369412-CMR?pretty=true&include_full_acl=true"

    -->
    {
    "group_permissions" : [ {
    "permissions" : [ "read" ],
    "user_type" : "registered"
    } ],
    "catalog_item_identity" : {
    "name" : "jteague_test_acl",
    "provider_id" : "DEMO_PROV",
    "granule_applicable" : true,
    "collection_applicable" : true,
    "collection_identifier" : {
    "concept_ids" : [ "C1200369410-DEMO_PROV", "C1200369415-DEMO_PROV" ],
    "entry_titles" : [ "jteague collection 1", "jteague collection 2" ]
    }
    }
    }

    Update ACL

    The Update ACL replaces the ACL definition, so you need to provide the entire record; partial updates aren't supported.

    Remove One of the Collections from the ACL

    curl -XPUT -i -H "Echo-Token: $sit_token" -H "Content-Type: application/json" "https://cmr.sit.earthdata.nasa.gov/access-control/acls/ACL1200369412-CMR" -d \

    '{
    "group_permissions" : [ {
    "permissions" : [ "read" ],
    "user_type" : "registered"
    } ],
    "catalog_item_identity" : {
    "name" : "jteague_test_acl",
    "provider_id" : "DEMO_PROV",
    "granule_applicable" : true,
    "collection_applicable" : true,
    "collection_identifier" : {
    "concept_ids" : [ "C1200369415-DEMO_PROV" ],
    "entry_titles" : [ "jteague collection 2" ]
    }
    }
    }'

    Modify the group_permissions

    curl -XPUT -i -H "Echo-Token: $sit_token" -H "Content-Type: application/json" "https://cmr.sit.earthdata.nasa.gov/access-control/acls/ACL1200369412-CMR" -d \

    '{
    "group_permissions" : [ {
    "permissions" : [ "read" ],
    "user_type" : "guest"
    } ],
    "catalog_item_identity" : {
    "name" : "jteague_test_acl",
    "provider_id" : "DEMO_PROV",
    "granule_applicable" : true,
    "collection_applicable" : true,
    "collection_identifier" : {
    "concept_ids" : [ "C1200369410-DEMO_PROV", "C1200369415-DEMO_PROV" ],
    "entry_titles" : [ "jteague collection 1", "jteague collection 2" ]
    }
    }
    }
    '

  6. Thanks for the sample API commands. We (GES_DISC) have around 1200 collections. So, we have to include all the collections in a modify request even if we only add/remove one of the collection?

    I think I found the ACLs that we need to be working on under UAT environment:

    {
    "revision_id" : 533,
    "concept_id" : "ACL1216477530-CMR",
    "identity_type" : "Catalog Item",
    "name" : "Selected Collections",
    "location" : "https://cmr.uat.earthdata.nasa.gov:443/access-control/acls/ACL1216477530-CMR"
    }

    Using your provided "Retrieve ACL" command, I got a very long list of "concept_ids" and "entry_titles".  So, if I have to hide one of those collections, I have run a "Update ACL" command you provided to include that entire list minus one collection that I want to hide?