Create an asset type
curl --request POST \
--url https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types \
--header 'Content-Type: application/json' \
--header 'OW-KEY: <api-key>' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"id": 123,
"primarySpendCategory": 123,
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"allProblemTypeIds": [
123
],
"allSpendCategoryIds": [
123
],
"depreciationClassId": 123,
"requiredFields": [
{}
],
"optionalFields": [
{}
],
"replaceMarkupOnOriginalCost": 123,
"replacementThreshold": 123,
"usesRefrigerant": true,
"applianceCategory": "<string>",
"refrigerantTypeCode": "<string>",
"fullChargeLb": 123
}
'import requests
url = "https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types"
payload = {
"name": "<string>",
"id": 123,
"primarySpendCategory": 123,
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"allProblemTypeIds": [123],
"allSpendCategoryIds": [123],
"depreciationClassId": 123,
"requiredFields": [{}],
"optionalFields": [{}],
"replaceMarkupOnOriginalCost": 123,
"replacementThreshold": 123,
"usesRefrigerant": True,
"applianceCategory": "<string>",
"refrigerantTypeCode": "<string>",
"fullChargeLb": 123
}
headers = {
"X-API-KEY": "<api-key>",
"OW-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-KEY': '<api-key>',
'OW-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
id: 123,
primarySpendCategory: 123,
attachments: [{fileName: '<string>', fileId: '<string>'}],
allProblemTypeIds: [123],
allSpendCategoryIds: [123],
depreciationClassId: 123,
requiredFields: [{}],
optionalFields: [{}],
replaceMarkupOnOriginalCost: 123,
replacementThreshold: 123,
usesRefrigerant: true,
applianceCategory: '<string>',
refrigerantTypeCode: '<string>',
fullChargeLb: 123
})
};
fetch('https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types', 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.useopenwrench.com/api/external/v1/buyer/asset/asset_types",
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([
'name' => '<string>',
'id' => 123,
'primarySpendCategory' => 123,
'attachments' => [
[
'fileName' => '<string>',
'fileId' => '<string>'
]
],
'allProblemTypeIds' => [
123
],
'allSpendCategoryIds' => [
123
],
'depreciationClassId' => 123,
'requiredFields' => [
[
]
],
'optionalFields' => [
[
]
],
'replaceMarkupOnOriginalCost' => 123,
'replacementThreshold' => 123,
'usesRefrigerant' => true,
'applianceCategory' => '<string>',
'refrigerantTypeCode' => '<string>',
'fullChargeLb' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"OW-KEY: <api-key>",
"X-API-KEY: <api-key>"
],
]);
$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://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"id\": 123,\n \"primarySpendCategory\": 123,\n \"attachments\": [\n {\n \"fileName\": \"<string>\",\n \"fileId\": \"<string>\"\n }\n ],\n \"allProblemTypeIds\": [\n 123\n ],\n \"allSpendCategoryIds\": [\n 123\n ],\n \"depreciationClassId\": 123,\n \"requiredFields\": [\n {}\n ],\n \"optionalFields\": [\n {}\n ],\n \"replaceMarkupOnOriginalCost\": 123,\n \"replacementThreshold\": 123,\n \"usesRefrigerant\": true,\n \"applianceCategory\": \"<string>\",\n \"refrigerantTypeCode\": \"<string>\",\n \"fullChargeLb\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("OW-KEY", "<api-key>")
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.post("https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types")
.header("X-API-KEY", "<api-key>")
.header("OW-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"id\": 123,\n \"primarySpendCategory\": 123,\n \"attachments\": [\n {\n \"fileName\": \"<string>\",\n \"fileId\": \"<string>\"\n }\n ],\n \"allProblemTypeIds\": [\n 123\n ],\n \"allSpendCategoryIds\": [\n 123\n ],\n \"depreciationClassId\": 123,\n \"requiredFields\": [\n {}\n ],\n \"optionalFields\": [\n {}\n ],\n \"replaceMarkupOnOriginalCost\": 123,\n \"replacementThreshold\": 123,\n \"usesRefrigerant\": true,\n \"applianceCategory\": \"<string>\",\n \"refrigerantTypeCode\": \"<string>\",\n \"fullChargeLb\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["OW-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"id\": 123,\n \"primarySpendCategory\": 123,\n \"attachments\": [\n {\n \"fileName\": \"<string>\",\n \"fileId\": \"<string>\"\n }\n ],\n \"allProblemTypeIds\": [\n 123\n ],\n \"allSpendCategoryIds\": [\n 123\n ],\n \"depreciationClassId\": 123,\n \"requiredFields\": [\n {}\n ],\n \"optionalFields\": [\n {}\n ],\n \"replaceMarkupOnOriginalCost\": 123,\n \"replacementThreshold\": 123,\n \"usesRefrigerant\": true,\n \"applianceCategory\": \"<string>\",\n \"refrigerantTypeCode\": \"<string>\",\n \"fullChargeLb\": 123\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"data": {
"name": "<string>",
"usesRefrigerant": true,
"buyerCompanyId": 123,
"isDeleted": true,
"id": 123,
"primarySpendCategory": 123,
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"allProblemTypeIds": [
123
],
"allProblemTypeIdsAsString": "<string>",
"allProblemTypes": [
{
"id": 123,
"name": "<string>"
}
],
"allProblemTypesName": "<string>",
"allSpendCategories": [
123
],
"depreciationClassId": 123,
"depreciationClassName": "<string>",
"requiredFields": [
{}
],
"optionalFields": [
{}
],
"replaceMarkupOnOriginalCost": 123,
"replacementThreshold": 123,
"applianceCategory": "<string>",
"refrigerantTypeCode": "<string>",
"fullChargeLb": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
},
"status": "ok"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}Asset Types
Create an asset type
Creates an asset type. buyerCompanyId is derived from the API key and cannot be set by the caller. applianceCategory, refrigerantTypeCode and fullChargeLb accept an explicit null to clear the class-level default.
POST
/
v1
/
buyer
/
asset
/
asset_types
Create an asset type
curl --request POST \
--url https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types \
--header 'Content-Type: application/json' \
--header 'OW-KEY: <api-key>' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"name": "<string>",
"id": 123,
"primarySpendCategory": 123,
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"allProblemTypeIds": [
123
],
"allSpendCategoryIds": [
123
],
"depreciationClassId": 123,
"requiredFields": [
{}
],
"optionalFields": [
{}
],
"replaceMarkupOnOriginalCost": 123,
"replacementThreshold": 123,
"usesRefrigerant": true,
"applianceCategory": "<string>",
"refrigerantTypeCode": "<string>",
"fullChargeLb": 123
}
'import requests
url = "https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types"
payload = {
"name": "<string>",
"id": 123,
"primarySpendCategory": 123,
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"allProblemTypeIds": [123],
"allSpendCategoryIds": [123],
"depreciationClassId": 123,
"requiredFields": [{}],
"optionalFields": [{}],
"replaceMarkupOnOriginalCost": 123,
"replacementThreshold": 123,
"usesRefrigerant": True,
"applianceCategory": "<string>",
"refrigerantTypeCode": "<string>",
"fullChargeLb": 123
}
headers = {
"X-API-KEY": "<api-key>",
"OW-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-API-KEY': '<api-key>',
'OW-KEY': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: '<string>',
id: 123,
primarySpendCategory: 123,
attachments: [{fileName: '<string>', fileId: '<string>'}],
allProblemTypeIds: [123],
allSpendCategoryIds: [123],
depreciationClassId: 123,
requiredFields: [{}],
optionalFields: [{}],
replaceMarkupOnOriginalCost: 123,
replacementThreshold: 123,
usesRefrigerant: true,
applianceCategory: '<string>',
refrigerantTypeCode: '<string>',
fullChargeLb: 123
})
};
fetch('https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types', 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.useopenwrench.com/api/external/v1/buyer/asset/asset_types",
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([
'name' => '<string>',
'id' => 123,
'primarySpendCategory' => 123,
'attachments' => [
[
'fileName' => '<string>',
'fileId' => '<string>'
]
],
'allProblemTypeIds' => [
123
],
'allSpendCategoryIds' => [
123
],
'depreciationClassId' => 123,
'requiredFields' => [
[
]
],
'optionalFields' => [
[
]
],
'replaceMarkupOnOriginalCost' => 123,
'replacementThreshold' => 123,
'usesRefrigerant' => true,
'applianceCategory' => '<string>',
'refrigerantTypeCode' => '<string>',
'fullChargeLb' => 123
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"OW-KEY: <api-key>",
"X-API-KEY: <api-key>"
],
]);
$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://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"id\": 123,\n \"primarySpendCategory\": 123,\n \"attachments\": [\n {\n \"fileName\": \"<string>\",\n \"fileId\": \"<string>\"\n }\n ],\n \"allProblemTypeIds\": [\n 123\n ],\n \"allSpendCategoryIds\": [\n 123\n ],\n \"depreciationClassId\": 123,\n \"requiredFields\": [\n {}\n ],\n \"optionalFields\": [\n {}\n ],\n \"replaceMarkupOnOriginalCost\": 123,\n \"replacementThreshold\": 123,\n \"usesRefrigerant\": true,\n \"applianceCategory\": \"<string>\",\n \"refrigerantTypeCode\": \"<string>\",\n \"fullChargeLb\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
req.Header.Add("OW-KEY", "<api-key>")
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.post("https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types")
.header("X-API-KEY", "<api-key>")
.header("OW-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"id\": 123,\n \"primarySpendCategory\": 123,\n \"attachments\": [\n {\n \"fileName\": \"<string>\",\n \"fileId\": \"<string>\"\n }\n ],\n \"allProblemTypeIds\": [\n 123\n ],\n \"allSpendCategoryIds\": [\n 123\n ],\n \"depreciationClassId\": 123,\n \"requiredFields\": [\n {}\n ],\n \"optionalFields\": [\n {}\n ],\n \"replaceMarkupOnOriginalCost\": 123,\n \"replacementThreshold\": 123,\n \"usesRefrigerant\": true,\n \"applianceCategory\": \"<string>\",\n \"refrigerantTypeCode\": \"<string>\",\n \"fullChargeLb\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useopenwrench.com/api/external/v1/buyer/asset/asset_types")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["OW-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"id\": 123,\n \"primarySpendCategory\": 123,\n \"attachments\": [\n {\n \"fileName\": \"<string>\",\n \"fileId\": \"<string>\"\n }\n ],\n \"allProblemTypeIds\": [\n 123\n ],\n \"allSpendCategoryIds\": [\n 123\n ],\n \"depreciationClassId\": 123,\n \"requiredFields\": [\n {}\n ],\n \"optionalFields\": [\n {}\n ],\n \"replaceMarkupOnOriginalCost\": 123,\n \"replacementThreshold\": 123,\n \"usesRefrigerant\": true,\n \"applianceCategory\": \"<string>\",\n \"refrigerantTypeCode\": \"<string>\",\n \"fullChargeLb\": 123\n}"
response = http.request(request)
puts response.read_body{
"type": "<string>",
"data": {
"name": "<string>",
"usesRefrigerant": true,
"buyerCompanyId": 123,
"isDeleted": true,
"id": 123,
"primarySpendCategory": 123,
"attachments": [
{
"fileName": "<string>",
"fileId": "<string>"
}
],
"allProblemTypeIds": [
123
],
"allProblemTypeIdsAsString": "<string>",
"allProblemTypes": [
{
"id": 123,
"name": "<string>"
}
],
"allProblemTypesName": "<string>",
"allSpendCategories": [
123
],
"depreciationClassId": 123,
"depreciationClassName": "<string>",
"requiredFields": [
{}
],
"optionalFields": [
{}
],
"replaceMarkupOnOriginalCost": 123,
"replacementThreshold": 123,
"applianceCategory": "<string>",
"refrigerantTypeCode": "<string>",
"fullChargeLb": 123,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
},
"status": "ok"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}{
"message": "<string>",
"type": "<string>",
"status": "error",
"traceId": "<string>"
}Auktoriseringar
OpenWrench shared secret. Required on every request alongside X-API-KEY; issued together with your API key.
Kropp
application/json
Present only when upserting an existing type.
Show child attributes
Show child attributes
Must be positive when supplied.