Create a User
POST {{apiPath}}/scim/v2/Users
The POST /scim/v2/Users endpoint creates a new user resource, providing a complete representation of the resource in the request body. Read-only attributes such as meta can be omitted.
If the request is successful, the server returns a response with a status code of 201, with the resource’s canonical URI as the value of the Location header (for example, Location: \https://example.com:443/scim/v2/Users/5caa81af-ec05-41ff-a709-c7378007a99c.)
The User resource and its attributes are defined in RFC 7643, Section 4.1.
Body
raw ( application/scim+json )
{
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
}
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff '{{apiPath}}/scim/v2/Users' \
--header 'Content-Type: application/scim+json' \
--header 'Authorization: Bearer {{accessToken}}' \
--data-raw '{
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
}'
var options = new RestClientOptions("{{apiPath}}/scim/v2/Users")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Post);
request.AddHeader("Content-Type", "application/scim+json");
request.AddHeader("Authorization", "Bearer {{accessToken}}");
var body = @"{" + "\n" +
@" ""emails"": [" + "\n" +
@" {" + "\n" +
@" ""primary"": true," + "\n" +
@" ""type"": ""work""," + "\n" +
@" ""value"": ""pat.conley@runciter.com""" + "\n" +
@" }" + "\n" +
@" ]," + "\n" +
@" ""name"": {" + "\n" +
@" ""familyName"": ""Conley""," + "\n" +
@" ""formatted"": ""Pat Conley""," + "\n" +
@" ""givenName"": ""Pat""" + "\n" +
@" }," + "\n" +
@" ""password"": ""valis""," + "\n" +
@" ""schemas"": [" + "\n" +
@" ""urn:pingidentity:schemas:User:1.0""," + "\n" +
@" ""urn:pingidentity:schemas:sample:profile:1.0""" + "\n" +
@" ]," + "\n" +
@" ""urn:pingidentity:schemas:sample:profile:1.0"": {" + "\n" +
@" ""birthDate"": ""1948-07-13""" + "\n" +
@" }," + "\n" +
@" ""userName"": ""pconley""" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{apiPath}}/scim/v2/Users"
method := "POST"
payload := strings.NewReader(`{
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/scim+json")
req.Header.Add("Authorization", "Bearer {{accessToken}}")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
POST /scim/v2/Users HTTP/1.1
Host: {{apiPath}}
Content-Type: application/scim+json
Authorization: Bearer {{accessToken}}
{
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/scim+json");
RequestBody body = RequestBody.create(mediaType, "{\n \"emails\": [\n {\n \"primary\": true,\n \"type\": \"work\",\n \"value\": \"pat.conley@runciter.com\"\n }\n ],\n \"name\": {\n \"familyName\": \"Conley\",\n \"formatted\": \"Pat Conley\",\n \"givenName\": \"Pat\"\n },\n \"password\": \"valis\",\n \"schemas\": [\n \"urn:pingidentity:schemas:User:1.0\",\n \"urn:pingidentity:schemas:sample:profile:1.0\"\n ],\n \"urn:pingidentity:schemas:sample:profile:1.0\": {\n \"birthDate\": \"1948-07-13\"\n },\n \"userName\": \"pconley\"\n}");
Request request = new Request.Builder()
.url("{{apiPath}}/scim/v2/Users")
.method("POST", body)
.addHeader("Content-Type", "application/scim+json")
.addHeader("Authorization", "Bearer {{accessToken}}")
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{apiPath}}/scim/v2/Users",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/scim+json",
"Authorization": "Bearer {{accessToken}}"
},
"data": JSON.stringify({
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'POST',
'url': '{{apiPath}}/scim/v2/Users',
'headers': {
'Content-Type': 'application/scim+json',
'Authorization': 'Bearer {{accessToken}}'
},
body: JSON.stringify({
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "{{apiPath}}/scim/v2/Users"
payload = json.dumps({
"emails": [
{
"primary": True,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
})
headers = {
'Content-Type': 'application/scim+json',
'Authorization': 'Bearer {{accessToken}}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{apiPath}}/scim/v2/Users');
$request->setMethod(HTTP_Request2::METHOD_POST);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Content-Type' => 'application/scim+json',
'Authorization' => 'Bearer {{accessToken}}'
));
$request->setBody('{\n "emails": [\n {\n "primary": true,\n "type": "work",\n "value": "pat.conley@runciter.com"\n }\n ],\n "name": {\n "familyName": "Conley",\n "formatted": "Pat Conley",\n "givenName": "Pat"\n },\n "password": "valis",\n "schemas": [\n "urn:pingidentity:schemas:User:1.0",\n "urn:pingidentity:schemas:sample:profile:1.0"\n ],\n "urn:pingidentity:schemas:sample:profile:1.0": {\n "birthDate": "1948-07-13"\n },\n "userName": "pconley"\n}');
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "json"
require "net/http"
url = URI("{{apiPath}}/scim/v2/Users")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/scim+json"
request["Authorization"] = "Bearer {{accessToken}}"
request.body = JSON.dump({
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"password": "valis",
"schemas": [
"urn:pingidentity:schemas:User:1.0",
"urn:pingidentity:schemas:sample:profile:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
})
response = http.request(request)
puts response.read_body
let parameters = "{\n \"emails\": [\n {\n \"primary\": true,\n \"type\": \"work\",\n \"value\": \"pat.conley@runciter.com\"\n }\n ],\n \"name\": {\n \"familyName\": \"Conley\",\n \"formatted\": \"Pat Conley\",\n \"givenName\": \"Pat\"\n },\n \"password\": \"valis\",\n \"schemas\": [\n \"urn:pingidentity:schemas:User:1.0\",\n \"urn:pingidentity:schemas:sample:profile:1.0\"\n ],\n \"urn:pingidentity:schemas:sample:profile:1.0\": {\n \"birthDate\": \"1948-07-13\"\n },\n \"userName\": \"pconley\"\n}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "{{apiPath}}/scim/v2/Users")!,timeoutInterval: Double.infinity)
request.addValue("application/scim+json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer {{accessToken}}", forHTTPHeaderField: "Authorization")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
201 Created
{
"emails": [
{
"primary": true,
"type": "work",
"value": "pat.conley@runciter.com"
}
],
"id": "76b4c133-87a7-4b2f-8058-4716e78b0fd4",
"meta": {
"created": "2016-07-30T00:01:23.824Z",
"lastModified": "2016-07-30T00:01:23.824Z",
"location": "https://example.com:443/scim/v2/Users/76b4c133-87a7-4b2f-8058-4716e78b0fd4",
"resourceType": "Users"
},
"name": {
"familyName": "Conley",
"formatted": "Pat Conley",
"givenName": "Pat"
},
"schemas": [
"urn:pingidentity:schemas:sample:profile:1.0",
"urn:pingidentity:schemas:User:1.0"
],
"urn:pingidentity:schemas:sample:profile:1.0": {
"birthDate": "1948-07-13"
},
"userName": "pconley"
}