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.8K Product Ideas
- 1.8K Ideas Exchange
- 1.6K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 9 Federated
- 2.9K Transform
- 102 SQL DataFlows
- 626 Datasets
- 2.2K Magic ETL
- 3.9K Visualize
- 2.5K Charting
- 753 Beast Mode
- 61 App Studio
- 41 Variables
- 692 Automate
- 177 Apps
- 456 APIs & Domo Developer
- 49 Workflows
- 10 DomoAI
- 38 Predict
- 16 Jupyter Workspaces
- 22 R & Python Tiles
- 398 Distribute
- 115 Domo Everywhere
- 276 Scheduled Reports
- 7 Software Integrations
- 130 Manage
- 127 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 11 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 110 Community Announcements
- 4.8K Archive