Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper to identify user portal information #32

Closed
JosiahParry opened this issue Mar 2, 2024 · 3 comments
Closed

Helper to identify user portal information #32

JosiahParry opened this issue Mar 2, 2024 · 3 comments

Comments

@JosiahParry
Copy link
Collaborator

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
Copy link
Collaborator Author

For example:

image

@JosiahParry
Copy link
Collaborator Author

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
Copy link
Collaborator Author

Closed by #36

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant