Adjust Points - Fabric

Adjust Points

cURL

curl --request POST \
  --url https://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "points": 100,
  "profileId": "f90a1da5-c072-48b7-a9ea-eb35c5dd506b",
  "pointType": "Base",
  "billingEntity": "Company_Club",
  "reasonCode": "7502",
  "setToPending": false
}
'```

### Python

```python
import requests

url = "https://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment"

payload = {
    "points": 100,
    "profileId": "f90a1da5-c072-48b7-a9ea-eb35c5dd506b",
    "pointType": "Base",
    "billingEntity": "Company_Club",
    "reasonCode": "7502",
    "setToPending": False
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

JavaScript

const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    points: 100,
    profileId: 'f90a1da5-c072-48b7-a9ea-eb35c5dd506b',
    pointType: 'Base',
    billingEntity: 'Company_Club',
    reasonCode: '7502',
    setToPending: false
  })
};

fetch('https://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment', 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://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'points' => 100,
    'profileId' => 'f90a1da5-c072-48b7-a9ea-eb35c5dd506b',
    'pointType' => 'Base',
    'billingEntity' => 'Company_Club',
    'reasonCode' => '7502',
    'setToPending' => false
  ]),
  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;
}

Go

package main

import (
    "fmt"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment"

payload := strings.NewReader("{\n  \"points\": 100,\n  \"profileId\": \"f90a1da5-c072-48b7-a9ea-eb35c5dd506b\",\n  \"pointType\": \"Base\",\n  \"billingEntity\": \"Company_Club\",\n  \"reasonCode\": \"7502\",\n  \"setToPending\": false\}")

req, _ := http.NewRequest("POST", 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))

}

Unirest (Java)

HttpResponse<String> response = Unirest.post("https://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"points\": 100,\n  \"profileId\": \"f90a1da5-c072-48b7-a9ea-eb35c5dd506b\",\n  \"pointType\": \"Base\",\n  \"billingEntity\": \"Company_Club\",\n  \"reasonCode\": \"7502\",\n  \"setToPending\": false}\")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://vanilla-dev02-loyalty.fabric.zone/api/v1/members/points-adjustment")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"points\": 100,\n  \"profileId\": \"f90a1da5-c072-48b7-a9ea-eb35c5dd506b\",\n  \"pointType\": \"Base\",\n  \"billingEntity\": \"Company_Club\",\n  \"reasonCode\": \"7502\",\n  \"setToPending\": false}\"

response = http.request(request)
puts response.read_body

Response Examples

Successful Response (200)

{
  "message": "Member points adjusted",
  "errors": {},
  "data": {
    "Message": "100.0 points added",
    "futureDate": false,
    "ExceptionString": "",
    "transactionCode": "78660e74-02e3-11e8-b443-00163e911bd2"
  },
  "status": 200
}

Error Response (400)

{
  "message": "Error message string",
  "errors": {
    "ExceptionString": ["Invalid Field"]
  },
  "data": null,
  "status": 400
}

Authentication Error (401)

{
  "detail": "Authentication Failed"
}