Pricefx REST API Reference
- Upsert an Object (and return old data)
The Pricefx Backend API
Request
Upserts an object (the object type must be specified by Type Code in the path).
To add a new object that does not exist, specify the sku parameter in the request.
To update an existing object, specify the sku or typedId parameter of the existing object. The /integrate method performs a partial update – it does not delete field values that have not been specified in the update request.
Please note This method is intended to be used with one or two objects and it allows you to update particular fields. The request will overwrite the existing data of the record being updated, regardless of other changes. To insert more objects in bulk, please use the
/loaddata/{TypeCode}endpoint.
This operation is particularly useful if the caller does not (and should not) know about typed IDs and other internal data fields, i.e. typically in an integration scenario.
The only mandatory pre-requisite for this operation is that the object's defined business key fields (vary per object type) are present in every request. No typed ID or version fields are required. This also means that no version checking is performed, thus the request will overwrite existing data of that record, regardless of other changes.
Information You can upsert multiple records using one request. To do so, add multiple
dataobjects into your JSON. See the example below.
[
{
"data": {
"sku": "111111",
"typedId": "2147501227.P",
"label": "The New Label",
"unitOfMeasure": "EA",
"currency": "USD",
"formulaName": "priceLogic2",
"attribute1": "1",
"attribute2": "2",
"userGroupEdit": "Administrators",
"userGroupViewDetails": "PricingManagers"
}
},
{
"data": {
"sku": "222222",
"label": "The New Label 2",
"unitOfMeasure": "EA",
"currency": "EUR",
"formulaName": "priceLogic2",
"attribute1": "1",
"attribute2": "2",
"userGroupEdit": "Administrators",
"userGroupViewDetails": "PricingManagers"
}
}
]Enter the Type code of the entity you want to insert a data to. See the list of Type codes in the Pricefx Knowledge Base article.
The /integrate/P endpoint (Upsert a Product) is used in our example.
Information: Field names (columns) sent in your request might be different from our sample request schema. Custom fields (
attribute1..attribute30) can be retrieved using the/fetch/<entity>AM(AttributeMeta) endpoint, for example, use/fetch/RBTAMto retrieve Rebate Type attribute fields.
Specify field names and values you want to insert or update.
- Mock serverhttps://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/integrate/{TypeCode}
- URL:https://companynode.pricefx.com/pricefx/companypartition/integrate/{TypeCode}
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/integrate/P \
-H 'Content-Type: application/json' \
-d '{
"data": {
"sku": "111111",
"typedId": "2147501227.P",
"label": "The New Label",
"unitOfMeasure": "EA",
"currency": "USD",
"formulaName": "priceLogic2",
"attribute1": "1",
"attribute2": "2",
"userGroupEdit": "Administrators",
"userGroupViewDetails": "PricingManagers"
}
}'- listProductsResponseExample_resultFields
- listProductsResponseExample_valueFields
- listProductsResponseExample
{ "response": { "node": "node", "startRow": 0, "data": [ … ], "endRow": 8, "totalRows": 8, "status": 0 } }
Request
Upserts an object (the object type must be specified by Type Code in the path) and returns record details of the previous version. It allows you to check changes in the record.
To add a new object that does not exist, specify the sku parameter in the request.
To update an existing object, specify the sku or typedId parameter of the existing object. The /integrate method performs a partial update – it does not delete values from fields that have not been specified in the update request.
Please note: This method is intended to be used with one or two objects and it allows you to update particular fields. The request will overwrite the existing data of the record being updated, regardless of other changes. To insert more objects in bulk please use the
/loaddata/{TypeCode}endpoint.
This operation is particularly useful if the caller does not (and should not) know about typed IDs and other internal data fields, i.e. typically in an integration scenario.
The only mandatory pre-requisite for this operation is that the object's defined business key fields (vary per object type) are present in every request. No typed ID or version fields are required. This also means that no version checking is performed, thus the request will overwrite existing data of that record, regardless of other changes.
Information: You can upsert multiple records using one request. To do so, add multiple
dataobjects into your JSON. See the example below.
[
{
"data": {
"sku": "111111",
"typedId": "2147501227.P",
"label": "The New Label",
"unitOfMeasure": "EA",
"currency": "USD",
"formulaName": "priceLogic2",
"attribute1": "1",
"attribute2": "2",
"userGroupEdit": "Administrators",
"userGroupViewDetails": "PricingManagers"
}
},
{
"data": {
"sku": "222222",
"label": "The New Label 2",
"unitOfMeasure": "EA",
"currency": "EUR",
"formulaName": "priceLogic2",
"attribute1": "1",
"attribute2": "2",
"userGroupEdit": "Administrators",
"userGroupViewDetails": "PricingManagers"
}
}
]Specify the type code for the entity you want to work with. See the list of Type Codes in the Pricefx Knowledge Base article.'
The /integrate/P/returnolddata endpoint (upserts a product) is used in our example.
Please note: Field names (columns) sent in your request might be different from our sample request schema. Custom fields (attribute1..attribute30) can be retrieved using the /fetch/PAM endpoint.
Specify field names and values you want to insert or update.
- Mock serverhttps://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/integrate/{TypeCode}/returnolddata
- URL:https://companynode.pricefx.com/pricefx/companypartition/integrate/{TypeCode}/returnolddata
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
https://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/integrate/P/returnolddata \
-H 'Content-Type: application/json' \
-d '{
"data": {
"sku": "111111",
"typedId": "2147501227.P",
"label": "The New Label",
"unitOfMeasure": "EA",
"currency": "USD",
"formulaName": "priceLogic2",
"attribute1": "1",
"attribute2": "2",
"userGroupEdit": "Administrators",
"userGroupViewDetails": "PricingManagers"
}
}'{ "response": { "node": "<node>", "oldData": { … }, "csrfToken": "<token>", "data": [ … ], "status": 0 } }
Request
Updates an existing object and returns details of the previous version. Updates specified fields (in the data property) of the record. Only one record can be updated per request (unless batched).
The object's type code. See the list of Type Codes.
Please note: The update request should contain all old values in the
oldValuesproperty (especially thetypedIdand theversion) and all values (along thetypedId) you want to update in thedataproperty.Apart from the version checks, additional integrity checks are performed. E.g. if fields that are part of the business key are changed then it is checked that no other object already is defined with those key(s).
Enter new field values. Multiple values can be updated. In our example the unitOfMeasure and label properties were updated.
Values of the object before the update. Especially important are typedId (to identify the object to update) and version (to detect date inconsistencies).
- Mock serverhttps://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/update/{TypeCode}/returnolddata
- URL:https://companynode.pricefx.com/pricefx/companypartition/update/{TypeCode}/returnolddata
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
-u <username>:<password> \
'https://api.pricefx.com/_mock/openapi/reference/pricefx-server_openapi/update/{TypeCode}/returnolddata' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"currency": "EUR",
"typedId": "2147501222.P"
},
"oldValues": {
"version": 5,
"typedId": "2147501222.P",
"sku": "33333",
"label": "Label Three",
"unitOfMeasure": "EA",
"userGroupEdit": "admin",
"userGroupViewDetails": null,
"currency": "CZK",
"formulaName": "PriceList",
"image": null,
"createDate": "2021-09-16T09:43:59",
"createdBy": 2147490696,
"lastUpdateDate": "2021-11-04T18:33:16",
"lastUpdateBy": 2147490696,
"attribute1": "56",
"attribute2": "3rd",
"attribute3": 4,
"attribute4": null,
"attribute5": null,
"attribute6": null,
"attribute7": null,
"attribute8": null,
"attribute9": null,
"attribute10": null,
"attribute11": null,
"attribute12": null,
"attribute13": null,
"attribute14": null,
"attribute15": null,
"attribute16": null,
"attribute17": null,
"attribute18": null,
"attribute19": null,
"attribute20": null,
"attribute21": null,
"attribute22": null,
"attribute23": null,
"attribute24": null,
"attribute25": null,
"attribute26": null,
"attribute27": null,
"attribute28": null,
"attribute29": null,
"attribute30": null
},
"operationType": "update",
"textMatchStyle": "exact"
}'See the Key-Value Database Storage Knowledge Base article for more details.
Here you can find all fields of the corresponding entity (represented by the type code).
Use the /metadata.describe endpoint to find out the correct data type of the field that is used in your partition.
Comments