Approve Sample Request
curl --request POST \
--url https://api.growi.io/api/public/v1/sample_requests/{id}/approve \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.growi.io/api/public/v1/sample_requests/{id}/approve"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.growi.io/api/public/v1/sample_requests/{id}/approve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.growi.io/api/public/v1/sample_requests/{id}/approve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.growi.io/api/public/v1/sample_requests/{id}/approve"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.growi.io/api/public/v1/sample_requests/{id}/approve")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.growi.io/api/public/v1/sample_requests/{id}/approve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"status": "pending",
"campaign_id": 123,
"campaign_name": "<string>",
"campaign_affiliate_id": 123,
"source": "<string>",
"creator": {
"user_id": 123,
"name": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"product": {
"id": 123,
"title": "<string>",
"sku": "<string>",
"url": "<string>",
"image_url": "<string>",
"shopify_id": "<string>",
"tik_tok_id": "<string>",
"amazon_product_id": "<string>"
},
"variant": {
"id": 123,
"title": "<string>",
"display_name": "<string>",
"sku": "<string>",
"external_id": "<string>",
"price": 123
},
"quantity": 123,
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>"
},
"order_id": "<string>",
"order_name": "<string>",
"tracking_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Approve sample request
Approves a pending sample request. Sends sample_request.approved. When the sample was picked during the creator’s campaign application, the application is accepted too.
POST
/
sample_requests
/
{id}
/
approve
Approve Sample Request
curl --request POST \
--url https://api.growi.io/api/public/v1/sample_requests/{id}/approve \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.growi.io/api/public/v1/sample_requests/{id}/approve"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.growi.io/api/public/v1/sample_requests/{id}/approve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.growi.io/api/public/v1/sample_requests/{id}/approve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.growi.io/api/public/v1/sample_requests/{id}/approve"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.growi.io/api/public/v1/sample_requests/{id}/approve")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.growi.io/api/public/v1/sample_requests/{id}/approve")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"status": "pending",
"campaign_id": 123,
"campaign_name": "<string>",
"campaign_affiliate_id": 123,
"source": "<string>",
"creator": {
"user_id": 123,
"name": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"email": "<string>",
"phone": "<string>"
},
"product": {
"id": 123,
"title": "<string>",
"sku": "<string>",
"url": "<string>",
"image_url": "<string>",
"shopify_id": "<string>",
"tik_tok_id": "<string>",
"amazon_product_id": "<string>"
},
"variant": {
"id": 123,
"title": "<string>",
"display_name": "<string>",
"sku": "<string>",
"external_id": "<string>",
"price": 123
},
"quantity": 123,
"shipping_address": {
"first_name": "<string>",
"last_name": "<string>",
"address_line_1": "<string>",
"address_line_2": "<string>",
"city": "<string>",
"state": "<string>",
"postal_code": "<string>",
"country": "<string>",
"phone": "<string>"
},
"order_id": "<string>",
"order_name": "<string>",
"tracking_url": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Approves a pending sample request and sends the
No request body is needed.
404: not found for your organization
422: the request is not pending
sample_request.approved webhook event. Create the order on your side after this call, or when you receive the webhook.
When the creator picked the sample while applying to the campaign, their application is accepted too, the same as on Shopify stores.
Requires a full-access API key (read-only keys are rejected).
Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
id | Integer | Sample request id | Yes |
Request example
curl -X POST "https://api.growi.io/api/public/v1/sample_requests/812345/approve" \
-H "Authorization: Bearer YOUR_PUBLIC_API_KEY"
Response
Returns the updated sample request indata, with "status": "approved". See List sample requests for the fields.
Error responses
403: read-only API key{ "error": "This API key is read-only and cannot modify data." }
{ "error": "Sample request not found" }
{ "error": "Cannot mark a shipped sample request as approved" }