jamesives/Fetch API Data
This action will handle authenticated API requests, allowing you to save the data from the request into your workspace.
View on GitHubTrust Signals
- Scorecard Score
- not yet scored
- Maintenance Recency
- Stale
- License
- None
Inputs
| name | description | required | default |
|---|---|---|---|
| endpoint | The URL of the endpoint you would like to retrieve data from. | yes | — |
| configuration | Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the secrets syntax, or you can reference data returned from the `TOKEN_ENDPOINT` request using the triple bracket syntax. | no | — |
| token-endpoint | If the `ENDPOINT` API requires you to make a request to get an access token prior to fetching data you can perform this task by specifying a token endpoint. Any data returned from the token end can be referenced in the `CONFIGURATION` variable using the triple bracket syntax. | no | — |
| token-configuration | Any applicable configuration settings that should be set such as authentication tokens. You can reference secrets using the secrets syntax. | no | — |
| retry | If you are working with an intermittent API you can toggle this option to true. Doing so will make the action try the request 3 times at random invervals before failing. | no | — |
| save-location | By default the save location of the JSON file is `fetch-api-data-action/data.json`, if you would like to override the directory you can do so by specifying a new one with this variable. | no | — |
| save-name | You can override the name of the exported `.json` file by specifying a new one here. You should _not_ include the file extension in your name. | no | — |
| variable-name | You can override the name of the variable name the action exports. This will work so long as set-output is true. | no | — |
| set-output | Determines if the returned data should be saved as an environment variable or not. This field defaults to `true`, but depending on your API response length you may need to toggle this. | no | true |
| debug | If set to true the action will log the API responses it receives in the terminal. | no | — |
| format | Allows you to modify the format of the saved file, for example you can use txt here to save the file as a txt file. This field defaults to json. | no | — |
| encoding | Allows you to specify the encoding the saved file, can be of type BufferEncoding: "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "latin1" | "binary" | "hex". | no | — |
Outputs
| name | description |
|---|---|
| fetchApiData | The requested data from the API stored as a string. |