Acknowledge invoice by ID - Fabric

Acknowledge invoice by ID

cURL

curl --request POST \
  --url https://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
{
  "invoiceId": "123"
}
'```

### Python

```python
import requests

url = "https://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement"

payload = { "invoiceId": "123" }
headers = {
    "x-site-context": "<x-site-context>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)

JavaScript (Fetch API)

const options = {
  method: 'POST',
  headers: {
    'x-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({invoiceId: '123'})
};

fetch('https://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement', 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://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'invoiceId' => '123'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "x-site-context: <x-site-context>"
  ],
]);

$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://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement"

payload := strings.NewReader("{\n  \"invoiceId\": \"123\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-site-context", "<x-site-context>")
    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))
}

Java

HttpResponse<String> response = Unirest.post("https://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement")
  .header("x-site-context", "<x-site-context>")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"invoiceId\": \"123\"\n}")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://prod01.oms.fabric.inc/api/v2/invoice/acknowledgement")

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

request = Net::HTTP::Post.new(url)
request["x-site-context"] = '<x-site-context>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"invoiceId\": \"123\"\n}"

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

Response Status Codes

Example Response Body

{
  "invoiceId": "62ff5c0bec0aed3c86202c32",
  "shipmentId": "62ff5c0bec0aed3c86202c32",
  "statusCode": "CREATED/POSTED/ACKNOWLEDGED",
  "channelId": "strate",
  "invoiceTotal": 245.7,
  "totalTaxAmount": 245.7,
  "currency": "dollar",
  "invoiceNumber": "23940791",
  "invoiceStatus": "CAPTURED/SETTLED",
  "invoiceType": "SHIPPING/APPEASEMENT",
  "invoiceDate": "2022-08-01T20:03:28.483971941Z",
  "shipmentNumber": "217088603",
  "shippedOn": "2022-08-01T20:03:28.483971941Z",
  "orders": [...],
  "locationNum": 3235,
  "location": "object",
  "retail": { ... },
  "createdAt": "2022-08-01T20:03:28.483971941Z",
  "updatedAt": "2022-08-01T20:03:28.483971941Z",
  "postedAt": "2022-08-01T20:03:28.483971941Z",
  "acknowledgedAt": "2022-08-01T20:03:28.483971941Z",
  "customer": { ... },
  "auditLogs": [...],
  "shipInfo": { ... },
  "attributes": {}
}

*Note: Replace <token> and <x-site-context> with actual values.