R-ArcGIS / arcgisutils

http://r.esri.com/arcgisutils/
Apache License 2.0
15 stars 2 forks source link

Helper to identify user portal information #32

Closed JosiahParry closed 8 months ago

JosiahParry commented 9 months ago
portals <- arc_base_req(
  "https://arcgis.com/sharing/rest/portals/self",
  arc_token()
) |>
  req_body_form(f = "json") |> 
  req_perform() |> 
  resp_body_string() |> 
  RcppSimdJson::fparse()

This function will return a massive list that includes just about every piece of information you could possibly want to know about your user in your authorized portal.

library(httr2)
#> Warning: package 'httr2' was built under R version 4.3.1
library(arcgisutils)
#> Warning: package 'arcgisutils' was built under R version 4.3.1
portals <- arc_base_req(
  "https://arcgis.com/sharing/rest/portals/self",
  arc_token()
) |>
  req_body_form(f = "json") |> 
  req_perform() |> 
  resp_body_string() |> 
  RcppSimdJson::fparse()

names(portals)
#>  [1] "2DStylesGroupQuery"                "3DBasemapGalleryGroupQuery"       
#>  [3] "analysisLayersGroupQuery"          "basemapGalleryGroupQuery"         
#>  [5] "cdnUrl"                            "colorSetsGroupQuery"              
#>  [7] "contentCategorySetsGroupQuery"     "customBaseUrl"                    
#>  [9] "defaultBasemap"                    "defaultDevBasemap"                
#> [11] "defaultExtent"                     "defaultVectorBasemap"             
#> [13] "description"                       "devBasemapGalleryGroupQuery"      
#> [15] "featuredGroups"                    "featuredItemsGroupQuery"          
#> [17] "galleryTemplatesGroupQuery"        "helpBase"                         
#> [19] "helperServices"                    "homePageFeaturedContent"          
#> [21] "homePageFeaturedContentCount"      "isPortal"                         
#> [23] "layerTemplatesGroupQuery"          "livingAtlasGroupQuery"            
#> [25] "name"                              "portalHostname"                   
#> [27] "portalMode"                        "portalName"                       
#> [29] "portalThumbnail"                   "rasterFunctionTemplatesGroupQuery"
#> [31] "rotatorPanels"                     "staticImagesUrl"                  
#> [33] "stylesGroupQuery"                  "supports3DTilesServices"          
#> [35] "supportsHostedServices"            "symbolSetsGroupQuery"             
#> [37] "templatesGroupQuery"               "thumbnail"                        
#> [39] "use3dBasemaps"                     "useVectorBasemaps"                
#> [41] "vectorBasemapGalleryGroupQuery"    "httpPort"                         
#> [43] "httpsPort"                         "ipCntryCode"                      
#> [45] "supportsOAuth"                     "isReadOnly"                       
#> [47] "currentVersion"

Created on 2024-03-02 with reprex v2.0.2

JosiahParry commented 9 months ago

For example:

image
JosiahParry commented 9 months ago

This metadata can be included into the token itself after authorization that could make the token kind of big but we would have literally all the information we might ever need...

JosiahParry commented 8 months ago

Closed by #36