Change the status of an enrollment
curl --request PATCH \
--url http://localhost:{port}/enrollments/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "approved",
"review_comment": "Good Choice"
}
'import requests
url = "http://localhost:{port}/enrollments/{id}"
payload = {
"status": "approved",
"review_comment": "Good Choice"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'approved', review_comment: 'Good Choice'})
};
fetch('http://localhost:{port}/enrollments/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://localhost:{port}/enrollments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'approved',
'review_comment' => 'Good Choice'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:{port}/enrollments/{id}"
payload := strings.NewReader("{\n \"status\": \"approved\",\n \"review_comment\": \"Good Choice\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("http://localhost:{port}/enrollments/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"approved\",\n \"review_comment\": \"Good Choice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:{port}/enrollments/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"approved\",\n \"review_comment\": \"Good Choice\"\n}"
response = http.request(request)
puts response.read_body{
"id": "d4add56e-c345-4ac9-b392-7a890a60559a",
"name": "Benjamin Zhang",
"email": "z@benwk.com",
"product_id": "393dea2f-1db7-4ffd-9527-d7b89ca59375",
"comment": "come on",
"status": "approved",
"created_at": "2023-05-06T00:00:00Z",
"updated_at": "2023-05-06T00:00:00Z",
"created_by": "98d91cd7-860d-4869-937a-5af32eff2f4a",
"updated_by": "98d91cd7-860d-4869-937a-5af32eff2f4a"
}{
"error": "An approved/rejected/processing enrollment cannot be reverted to pending status."
}Enrollment
Change the status of an enrollment
PATCH
/
enrollments
/
{id}
Change the status of an enrollment
curl --request PATCH \
--url http://localhost:{port}/enrollments/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"status": "approved",
"review_comment": "Good Choice"
}
'import requests
url = "http://localhost:{port}/enrollments/{id}"
payload = {
"status": "approved",
"review_comment": "Good Choice"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({status: 'approved', review_comment: 'Good Choice'})
};
fetch('http://localhost:{port}/enrollments/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "62437",
CURLOPT_URL => "http://localhost:{port}/enrollments/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'status' => 'approved',
'review_comment' => 'Good Choice'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://localhost:{port}/enrollments/{id}"
payload := strings.NewReader("{\n \"status\": \"approved\",\n \"review_comment\": \"Good Choice\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("http://localhost:{port}/enrollments/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"status\": \"approved\",\n \"review_comment\": \"Good Choice\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:{port}/enrollments/{id}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"status\": \"approved\",\n \"review_comment\": \"Good Choice\"\n}"
response = http.request(request)
puts response.read_body{
"id": "d4add56e-c345-4ac9-b392-7a890a60559a",
"name": "Benjamin Zhang",
"email": "z@benwk.com",
"product_id": "393dea2f-1db7-4ffd-9527-d7b89ca59375",
"comment": "come on",
"status": "approved",
"created_at": "2023-05-06T00:00:00Z",
"updated_at": "2023-05-06T00:00:00Z",
"created_by": "98d91cd7-860d-4869-937a-5af32eff2f4a",
"updated_by": "98d91cd7-860d-4869-937a-5af32eff2f4a"
}{
"error": "An approved/rejected/processing enrollment cannot be reverted to pending status."
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Your API version
Available options:
v1 Available options:
application/json, application/xml, application/x-www-form-urlencoded, application/octet-stream, application/pdf, text/plain, text/html, multipart/form-data Path Parameters
Body
application/json
Response
Success
Example:
"e0e50a85-ddfa-44cf-8cc4-1cd76c06bc54"
Example:
"Benjamin Zhang"
Example:
"z@benwk.com"
Example:
"9068ec25-b433-4bc4-8e99-bbbc4de2d43d"
Example:
"Let me in!"
Example:
"2023-05-07T00:00:00Z"
Example:
"2023-05-07T00:00:00Z"
Available options:
pending, processing, rejected, approved Example:
"pending"
REQUIRE metadata permissions
Example:
"98d91cd7-860d-4869-937a-5af32eff2f4a"
REQUIRE metadata permissions
Example:
"98d91cd7-860d-4869-937a-5af32eff2f4a"
Was this page helpful?