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": "[email protected]",
"alternateEmail": "[email protected]",
"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 <- '[email protected]'
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
- 10.5K All Categories
- 8 Connect
- 918 Connectors
- 250 Workbench
- 467 Transform
- 1.7K Magic ETL
- 69 SQL DataFlows
- 477 Datasets
- 193 Visualize
- 252 Beast Mode
- 2.1K Charting
- 11 Variables
- 17 Automate
- 354 APIs & Domo Developer
- 89 Apps
- 3 Workflows
- 20 Predict
- 5 Jupyter Workspaces
- 15 R & Python Tiles
- 246 Distribute
- 62 Domo Everywhere
- 243 Scheduled Reports
- 21 Manage
- 42 Governance & Security
- 173 Product Ideas
- 1.2K Ideas Exchange
- 12 Community Forums
- 27 Getting Started
- 14 Community Member Introductions
- 55 Community News
- 4.5K Archive