Javascript API Requests Continue to Result in 401 Errors
I've been working on creating an app within React JavaScript and am looking to import data through an API request to DOMO dataset. I've tried to use XML HTTP Requests, Fetch requests, and jQuery Ajax requests as well, utilizing my dataset's id and passing in my log in and/or client credentials to the request.
Despite these different efforts I have been unable to successfully call the API and encounter numerous 401 errors. What other steps do I need to take to complete this call successfully? Am I able to utilize these types of calls to DOMO?
Sample code snippet for Fetch Call:
const apiUrl = "https://api.domo.com/v1/datasets/{id}"
async function getUser() {
const response = await.fetch(apiUrl, {
method: 'GET',
headers: {
'Content-Type": "text/plain",
'Authorization': 'Basic' + btoa(username : password)
};
};
};
const data = await response.json();
console.log(data)
Answers
-
Update: I now seem to be calling into the API utilizing an access token but am now producing 302 errors along with Failed to Fetch errors. Any clue on how to resolve these?
0
Categories
- 10.5K All Categories
- 5 Connect
- 915 Connectors
- 250 Workbench
- 459 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 476 Datasets
- 185 Visualize
- 250 Beast Mode
- 2.1K Charting
- 11 Variables
- 16 Automate
- 354 APIs & Domo Developer
- 88 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 245 Distribute
- 62 Domo Everywhere
- 242 Scheduled Reports
- 20 Manage
- 41 Governance & Security
- 170 Product Ideas
- 1.2K Ideas Exchange
- 10 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive