You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cd730b3
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: NEWS.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,14 @@
1
+
# dtmapi (development version)
2
+
* Stylistic and stylistic-adjacent corrections to documentation.
3
+
4
+
* More elaborate explanation on how to set the subscription key, including
5
+
options for non-interactive environments and explicitly introducing the concept
6
+
of secrets management.
7
+
8
+
* Substantial corrections to documentation, including clarification of the environment variable being used (it is `DTM_SUBSCRIPTION_KEY`, not `DTM_API_KEY`).
9
+
10
+
* Apparently inconsequential change in API endpoint URL used by `get_all_operations()`: from "https://dtmapi.iom.int/v3/displacement/operation-List" to https://dtmapi.iom.int/v3/displacement/operation-list", but worth implementing to be safe and exact.
11
+
1
12
# dtmapi 0.1.0
2
13
3
14
* Version 3 of the DTM API requires the use of a valid subscription key in order
@@ -18,4 +29,4 @@ the API.
18
29
the `dtmapi` package, but it may technically be used by users to conveniently
19
30
return the currently available subscription key. HOWEVER, beware that the string
20
31
it returns is plain text and is more easily exposed, e.g. exposed to anyone
Copy file name to clipboardExpand all lines: README.Rmd
+19-10Lines changed: 19 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -52,15 +52,23 @@ the [DTM API Portal](https://dtm-apim-portal.iom.int/signin) and follow the
52
52
instructions there.
53
53
54
54
The subscription key is secret and should not be exposed. Once it is obtained,
55
-
the subscription key should be set for your current R session, assuming that the
56
-
`dtmapi` package is installed. To do this, use run the following in R:
55
+
the subscription key should be set for your current R session, assuming that the `dtmapi` package is installed. To do this, the environment variable `DTM_SUBSCRIPTION_KEY` needs to be defined. This can be done either interactively or non-interactively.
56
+
57
+
The interactive option is to call `set_subscription_key()`, like so:
57
58
58
59
```{r set_subscription_key_demo, eval = FALSE}
59
60
dtmapi::set_subscription_key()
60
61
```
61
62
62
-
At this point, the user will be prompted to input the key (hidden) into a pop-up
63
-
field.
63
+
At this point, the user will be prompted to input the key (hidden) into a pop-up field.
64
+
65
+
Some environments are non-interactive, and so running the above will likely result in an error. In such a case, the subscription key may be set non-interactively, by specifying the `key` parameter, like so:
66
+
```{r, eval = FALSE}
67
+
# Specifying `key` is required for non-interactive use.
However, this option is discouraged and should be avoided as much as possible, because it blatantly exposes the subscription key. The best option would be to engage in good secrets management practices, such as by using a .Renviron file (if applicable). Basic secrets management, and the issue of setting the subscription key in general, is elaborated on in more detail in `vignette("user_guide")`.
64
72
65
73
## Usage
66
74
When the subscription key is set, data on internal displacement may be retrieved through any of the following functions:
@@ -74,8 +82,7 @@ These all retrieve data from the DTM API and return said data in
74
82
the form of data frames.
75
83
76
84
Certain parameters have to be specified to any of these, the most important of which are either the `CountryName` or the `OperationName`. For information on the other parameters
77
-
and indeed all functions in `dtmapi`,
78
-
[see the documentation here.](https://displacement-tracking-matrix.github.io/dtmapi-R/reference/index.html)
85
+
and indeed all functions in `dtmapi`, [see the documentation here.](https://displacement-tracking-matrix.github.io/dtmapi-R/reference/index.html)
79
86
80
87
As a representative example of the earlier mentioned functions, see the following use of `get_idp_admin_1_data()`:
81
88
@@ -117,13 +124,15 @@ head(operations_df)
117
124
118
125
## User Guide
119
126
The information given here is further elaborated on in the user guide to
120
-
getting started with `dtmapi`, which is available through the panel at
121
-
the top of this page.
127
+
getting started with `dtmapi`, which is
128
+
accessible through `vignette("user_guide")`.
122
129
123
130
## Source Code
124
-
The source code for `dtmapi` is available on [GitHub](https://github.com/Displacement-tracking-Matrix/dtmapi-R).
0 commit comments