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.5K Connect
- 1.2K Connectors
- 300 Workbench
- 6 Cloud Amplifier
- 8 Federated
- 2.9K Transform
- 100 SQL DataFlows
- 616 Datasets
- 2.2K Magic ETL
- 3.8K Visualize
- 2.5K Charting
- 738 Beast Mode
- 56 App Studio
- 40 Variables
- 684 Automate
- 176 Apps
- 452 APIs & Domo Developer
- 46 Workflows
- 10 DomoAI
- 35 Predict
- 14 Jupyter Workspaces
- 21 R & Python Tiles
- 394 Distribute
- 113 Domo Everywhere
- 275 Scheduled Reports
- 6 Software Integrations
- 123 Manage
- 120 Governance & Security
- 8 Domo Community Gallery
- 38 Product Releases
- 10 Domo University
- 5.4K Community Forums
- 40 Getting Started
- 30 Community Member Introductions
- 108 Community Announcements
- 4.8K Archive