Create User Domo API with R in Rstudio HTTR 400 status
------Where I got the instructions------
https://developer.domo.com/docs/users-api-reference/users-2#Create%20a%20user
POST https://api.domo.com/v1/users?sendInvite=true
Content-Type: application/json
Accept: application/json
Authorization: bearer <your-valid-oauth-access-token>
{
"title": "Software Engineer",
"email": "leonhard.euler@domo.com",
"alternateEmail": "leonhardeuler@email.com",
"role": "Admin",
"phone": "888-361-1078",
"name": "Leonhard Euler",
"location": "American Fork",
"timezone": "",
"locale": "",
"employeeNumber": 23432
}
------------What was the result-------------
I'm trying to create a new user using HTTR in Domo. I keep getting a 400 error. I believe that the issue is with my "body = w" from below.
response [https://api.domo.com/v1/users?sendInvite=true]
Date:
Status: 400
Content-Type: application/json;charset=utf-8
Size:
------What I did------
library(DomoR)
library(curl) #interface to libcurl (to make API calls)
library(jsonlite) #convert json to list objects in R
library(httr) #GET and POST methods through https, etc.
#create
name <- 'Joshua James'
email <- 'Joshua.James@domo.com'
role <- 'Participant'
#build API call
auth <- 123456789........
url <- paste('https://api.domo.com/v1/users?sendInvite=true', 200, sep='')
#dynamically build the body of the post
w = paste('{ \"title\":[',"",'],
\"name\":[',name,'],
\"email\":[',email,'],
\"role\":"Participant,
}',sep = " ")
#create the new user
httr::POST(url=url, add_headers("Content-Type" = "application/json", "Accept" = "application/json", "Authorization" = auth), body = w)
Comments
-
Hi Joshua
There are a number of reasons that a 400 error can be returned. I would reach out to support and see if they have any logs that give anything specific. Before that, though I would double your access tokens and other account-specific information.
Jarvis
0
Categories
- All Categories
- 1.7K Product Ideas
- 1.7K Ideas Exchange
- 1.5K Connect
- 1.2K Connectors
- 295 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.8K Transform
- 97 SQL DataFlows
- 608 Datasets
- 2.1K Magic ETL
- 3.8K Visualize
- 2.4K Charting
- 709 Beast Mode
- 49 App Studio
- 39 Variables
- 667 Automate
- 170 Apps
- 446 APIs & Domo Developer
- 44 Workflows
- 7 DomoAI
- 33 Predict
- 13 Jupyter Workspaces
- 20 R & Python Tiles
- 391 Distribute
- 111 Domo Everywhere
- 274 Scheduled Reports
- 6 Software Integrations
- 115 Manage
- 112 Governance & Security
- Domo Community Gallery
- 31 Product Releases
- 9 Domo University
- 5.3K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 103 Community Announcements
- 4.8K Archive