API keys and login emails are tied to specific API organizations. However, if users are collaborating and their email is not registered with the same API org, it causes errors.
check_streetlight_api()
only checks the API key itself, not any associated login emails. You won't run into any errors until you try to create or access an analysis using a different login email.
Liz's email is registered "mndot_metcouncil_api"
Raven's is registered with "mndot_master"
Both of us have access to StreetLight through the same contract with MnDOT.
function |
login_email |
api_key |
status |
check_streetlight_api() |
NA |
"Myxxxxx" |
✔️ |
check_streetlight_api() |
NA |
"9bxxxxx" |
✔️ |
create_streetlight_analysis() |
raven.mcknight |
"9bxxxxx" |
✔️ |
create_streetlight_analysis() |
raven.mcknight |
"Myxxxxx" |
❌ |
create_streetlight_analysis() |
liz.roten |
"Myxxxxx" |
✔️ |
create_streetlight_analysis() |
liz.roten |
"9bxxxxx" |
❌ |
Worked examples
Here, we use Raven's key and Raven's email to create a new analysis and get "Analysis name must be unique" ✔️
library(streetlightR)
streetlight_api_key("9bxxxxxxxx")
#> ℹ Your API key has been added to your environment for this session only.
#> ℹ To install your API key for use in future sessions, run this function with
#> `install = TRUE`.
check_streetlight_api() # passes
#> ✔ API connection live
#> [1] "PASS"
create_streetlight_analysis(login_email = "[email protected]",
analysis_type = "Zone_Activity_Analysis",
analysis_name = "bike_gate_nov16_test",
travel_mode_type = "Bicycle",
output_type = "Volume",
origin_zone_set = "mndot_gate_validation_osm_nov16",
tags = list("streetlightR"))
#> Warning: Create analysis failed with message:
#> Analysis name has to be unique.
Created on 2022-11-18 with reprex v2.0.2
Here, we run with Liz's API key, and Raven's email, but get an error ❌
library(streetlightR)
streetlight_api_key("Myxxxxxxx")
#> ℹ Your API key has been added to your environment for this session only.
#> ℹ To install your API key for use in future sessions, run this function with
#> `install = TRUE`.
check_streetlight_api() # passes
#> ✔ API connection live
#> [1] "PASS"
create_streetlight_analysis(login_email = "[email protected]",
analysis_type = "Zone_Activity_Analysis",
analysis_name = "bike_gate_nov16_test",
travel_mode_type = "Bicycle",
output_type = "Volume",
origin_zone_set = "mndot_gate_validation_osm_nov16",
tags = list("streetlightR"))
#> Warning: Create analysis failed with message:
#> User '[email protected]' does not have access to the current api
#> organization.
Created on 2022-11-18 with reprex v2.0.2
However, if we try with Raven's key and Liz's email, we get an error ❌
library(streetlightR)
streetlight_api_key("9bxxxxxxxxx")
#> ℹ Your API key has been added to your environment for this session only.
#> ℹ To install your API key for use in future sessions, run this function with
#> `install = TRUE`.
check_streetlight_api() # passes
#> ✔ API connection live
#> [1] "PASS"
create_streetlight_analysis(login_email = "[email protected]",
analysis_type = "Zone_Activity_Analysis",
analysis_name = "bike_gate_nov16_test",
travel_mode_type = "Bicycle",
output_type = "Volume",
origin_zone_set = "mndot_gate_validation_osm_nov16",
tags = list("streetlightR"))
#> Warning: Create analysis failed with message:
#> Analysis name has to be unique.
Created on 2022-11-18 with reprex v2.0.2