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
- All Categories
- 1.2K Product Ideas
- 1.2K Ideas Exchange
- 1.3K Connect
- 1.1K Connectors
- 273 Workbench
- Cloud Amplifier
- 3 Federated
- 2.7K Transform
- 78 SQL DataFlows
- 524 Datasets
- 2.1K Magic ETL
- 2.9K Visualize
- 2.2K Charting
- 433 Beast Mode
- 22 Variables
- 510 Automate
- 114 Apps
- 388 APIs & Domo Developer
- 8 Workflows
- 26 Predict
- 10 Jupyter Workspaces
- 16 R & Python Tiles
- 331 Distribute
- 76 Domo Everywhere
- 255 Scheduled Reports
- 65 Manage
- 65 Governance & Security
- 1 Product Release Questions
- Community Forums
- 40 Getting Started
- 26 Community Member Introductions
- 67 Community Announcements
- 4.8K Archive