Security error using fred/fetch
Mostrar comentarios más antiguos
Hi,
I recently updated the Mac software to Sequoia, and started to receive the following error for a code that has always worked before:
Error using fred/fetch
Unable to retrieve data. Verify valid security request.
Do you know how to fix this? I have updated the Matlab version to the latest, and the error still persists.
Thanks!
11 comentarios
Luca
el 26 de Jul. de 2025
url = 'https://fred.stlouisfed.org/';
c = fred(url);
series = 'DEXUSEU';
d=fetch(c,series)
Google says FRED requires a valid API key downloaded from the site and somehow integrated into the connection object. I can find no reference to how this is handled in the MATLAB documentation; apparently there must have been some behind the scenes machinations going on that the update has broken.
Think another you'll have to submit this to Mathworks as an official support request/bug at <Product Support Page> unless somebody who has previously figured it out stumbles by. Unfortunately, Mathworks won't respond over the weekend...
Luca
el 26 de Jul. de 2025
It appears that when you get the API code, it is set as an environment variable. I don't know how that is done in MAC OS. It would appear given the lack of any comment on it by the fetch documentation that the TB must do this behind the scenes on installation with a generic API key Mathworks ships. Any chance of being able to discover what that might have been on your system prior to the upgrade?
Configure API Key in MATLAB:
- Environment Variable (recommended): For better security and reusability, you can set your FRED API key as an environment variable (e.g., FRED_API_KEY).
Alternatively, reinstalling the toolbox would probably do the trick...
Luca
el 26 de Jul. de 2025
Luca
el 26 de Jul. de 2025
dpb
el 26 de Jul. de 2025
Navigate to the FRED site and there are links to follow...this will be your own as opposed to a generic one that must have been somehow tied into the Datafeed TB (which I don't have, so don't know anything about what it actually did/does other than what is in the documentation, which doesn't mention the API key at all). That won't be a problem it would appear it is a free service just for the signing into although I've never used it...
Luca
el 26 de Jul. de 2025
Set the environment variable to that key value and theory says fetch should find it...I've never seen a Mac since Apple II days so I've no idea how you actually do that...it may have to be at the system level before you start the MATLAB session again, however, for it to be visible, but you can try the MATLAB setenv function in the active session and see if the toolbox reads the environment dynamically or only caches it on startup.
Apparently, while not recommended practice, you can add it as a named parameter in the fred function call to create the object.
Yvan Becard
el 19 de Ag. de 2025
Same error with MATLAB R2025a and Ubuntu 24.04.3 LTS
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Help and Support en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!