Help Setting Up Alert API #409
Unanswered
numenor-dev
asked this question in
Q&A
Replies: 2 comments 7 replies
-
Check the Specification tab under https://www.weather.gov/documentation/services-web-api for the allowable Accept headers for the /alerts endpoint. "application/json" doesn't work. I don't know if this will fix it, but it's necessary for the fetch to succeed. |
Beta Was this translation helpful? Give feedback.
6 replies
-
If you're using JS in the browser you won't be able to set the user agent.
It will always be sent as the user agent the browser sends. If you're using
node you can set the user agent
https://nodejs.org/dist/latest-v14.x/docs/api/http.html#http_request_setheader_name_value
request.setHeader('User-Agent', '<custom user agent>');
…On Wed, May 12, 2021, 3:53 PM JJKraw ***@***.***> wrote:
I fetch from PHP, so I'm not sure how to correctly code it from JS.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#409 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AMIJCKKIX37LROLPPA7BASTTNLTE7ANCNFSM44PWJKWA>
.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I'm just looking for guidance on fetching data from a weather alert API by using https://api.weather.gov/alerts in React JS.
I thought I had set it up correctly:
`class FetchWeatherData extends Component {
}`
So far nothing is returned and console shows "Uncaught (in promise) TypeError: NetworkError when attempting to fetch resource."
Any help is appreciated!
Beta Was this translation helpful? Give feedback.
All reactions