Process export
When you have fetched all expense data from the voucher endpoint, you need to update the status of each voucher to mark the export as processed. The status of a voucher can be SUCCESS or FAILED.
For the successful flow, the export package and its expense reports are moved forward in the process, either to the next recipient or to the status SENT. You can also provide a voucher number when updating the status for additional control and security. This will make sure that the voucher can only be sent once.
{
"voucherUpdates": [
{
"id": "84bd3279bada45bfa97b0a3fd06fa775",
"status": "SUCCESS",
"bookingDate": "2024-11-21T08:29:00Z",
"voucherNumber": "377",
"informationText": "External System says OK"
}
]
}
If an error occurs in the external system for some reason and you want to abort the import, you can report an error on a voucher, this will make the report(s) remain in status Ready to send. Ideally, you should also send a message highlighting the error and how to solve it.
{
"voucherUpdates":
[
{
"id": "9cfefc3a60f641aea631cf573ea15e6f",
"status": "FAILED",
"errorText": "Processing error please correct"
}
]
}
curl --request PUT \
--url https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"voucherUpdates": [
{
"id": "70673d31e9704f768d70748c173ad7c1",
"status": "SUCCESS",
"bookingDate": "2023-02-21T13:58:00Z",
"voucherNumber": "123",
"informationText": null,
"errorText": null
}
]
}
'import requests
url = "https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus"
payload = { "voucherUpdates": [
{
"id": "70673d31e9704f768d70748c173ad7c1",
"status": "SUCCESS",
"bookingDate": "2023-02-21T13:58:00Z",
"voucherNumber": "123",
"informationText": None,
"errorText": None
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
voucherUpdates: [
{
id: '70673d31e9704f768d70748c173ad7c1',
status: 'SUCCESS',
bookingDate: '2023-02-21T13:58:00Z',
voucherNumber: '123',
informationText: null,
errorText: null
}
]
})
};
fetch('https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus', 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://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'voucherUpdates' => [
[
'id' => '70673d31e9704f768d70748c173ad7c1',
'status' => 'SUCCESS',
'bookingDate' => '2023-02-21T13:58:00Z',
'voucherNumber' => '123',
'informationText' => null,
'errorText' => null
]
]
]),
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 := "https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus"
payload := strings.NewReader("{\n \"voucherUpdates\": [\n {\n \"id\": \"70673d31e9704f768d70748c173ad7c1\",\n \"status\": \"SUCCESS\",\n \"bookingDate\": \"2023-02-21T13:58:00Z\",\n \"voucherNumber\": \"123\",\n \"informationText\": null,\n \"errorText\": null\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"voucherUpdates\": [\n {\n \"id\": \"70673d31e9704f768d70748c173ad7c1\",\n \"status\": \"SUCCESS\",\n \"bookingDate\": \"2023-02-21T13:58:00Z\",\n \"voucherNumber\": \"123\",\n \"informationText\": null,\n \"errorText\": null\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voucherUpdates\": [\n {\n \"id\": \"70673d31e9704f768d70748c173ad7c1\",\n \"status\": \"SUCCESS\",\n \"bookingDate\": \"2023-02-21T13:58:00Z\",\n \"voucherNumber\": \"123\",\n \"informationText\": null,\n \"errorText\": null\n }\n ]\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The id of the organization of the user UUID without dashes (32-character hex string)
^[0-9a-fA-F]{32}$The external export id UUID without dashes (32-character hex string)
^[0-9a-fA-F]{32}$Body
Response
Accepted
curl --request PUT \
--url https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"voucherUpdates": [
{
"id": "70673d31e9704f768d70748c173ad7c1",
"status": "SUCCESS",
"bookingDate": "2023-02-21T13:58:00Z",
"voucherNumber": "123",
"informationText": null,
"errorText": null
}
]
}
'import requests
url = "https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus"
payload = { "voucherUpdates": [
{
"id": "70673d31e9704f768d70748c173ad7c1",
"status": "SUCCESS",
"bookingDate": "2023-02-21T13:58:00Z",
"voucherNumber": "123",
"informationText": None,
"errorText": None
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
voucherUpdates: [
{
id: '70673d31e9704f768d70748c173ad7c1',
status: 'SUCCESS',
bookingDate: '2023-02-21T13:58:00Z',
voucherNumber: '123',
informationText: null,
errorText: null
}
]
})
};
fetch('https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus', 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://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'voucherUpdates' => [
[
'id' => '70673d31e9704f768d70748c173ad7c1',
'status' => 'SUCCESS',
'bookingDate' => '2023-02-21T13:58:00Z',
'voucherNumber' => '123',
'informationText' => null,
'errorText' => null
]
]
]),
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 := "https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus"
payload := strings.NewReader("{\n \"voucherUpdates\": [\n {\n \"id\": \"70673d31e9704f768d70748c173ad7c1\",\n \"status\": \"SUCCESS\",\n \"bookingDate\": \"2023-02-21T13:58:00Z\",\n \"voucherNumber\": \"123\",\n \"informationText\": null,\n \"errorText\": null\n }\n ]\n}")
req, _ := http.NewRequest("PUT", 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.put("https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"voucherUpdates\": [\n {\n \"id\": \"70673d31e9704f768d70748c173ad7c1\",\n \"status\": \"SUCCESS\",\n \"bookingDate\": \"2023-02-21T13:58:00Z\",\n \"voucherNumber\": \"123\",\n \"informationText\": null,\n \"errorText\": null\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://stage-api.findity.com/api/v1/connect/organizations/{organizationId}/exports/{exportId}/updatestatus")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"voucherUpdates\": [\n {\n \"id\": \"70673d31e9704f768d70748c173ad7c1\",\n \"status\": \"SUCCESS\",\n \"bookingDate\": \"2023-02-21T13:58:00Z\",\n \"voucherNumber\": \"123\",\n \"informationText\": null,\n \"errorText\": null\n }\n ]\n}"
response = http.request(request)
puts response.read_body
