Documents - Change Unique Code

👍

Objective

This cookbook explains how to change a document's unique identifier in Quable PIM.

Documents display all of the attributes that describe your products.

You may have several different types of documents within your Quable PIM classifications, so it's important to understand your hierarchy.
150

Process Overview

It may become necessary at some point to change a document's unique identifier in Quable PIM (e.g., to synchronize with a change in your ERP). To do so, all you need to do is make a simple PUT call to Quable PIM API.

Push the new code

To change a document's unique code, you must identify its current unique code.

URL Parameters
Endpoint /documents/{{code}}

Note: {{code}} is the current unique code of the document to update.
API v4 endpoint
HTTP Method PUT
Request Body
Required Attributes code string The new unique code of the document to be set.

Example

Here's an example where the document's unique code is changed from foo to bar.

import requests
url= "https://{{YOUR-PIM}}.quable.com.quable.com/api_1.php/documents/foo"
payload={
    "code" : "bar"
}
headers= {
  'Content-Type': 'application/json',
  'Authorization': 'Bearer ...'
}
response= requests.request("PUT", url, headers=headers, data=payload)

The JSON response to a successful request includes:

Response Header
HTTP Response Code 200 integer The request was successful.
Response Body
location string The API URL of the document.
code string The new unique code of the document.
document_type_code string The code of the document's type.
success boolean True if everything is ok, else False.
warnings array(string) An array of warnings about the request payload.

Example

{
    "success": true,
    "code": "bar",
    "active": true,
    "attribute_set_code": null,
    "document_type_code": "postman_automation",
    "location": "/documents/bar",
    "warnings": []
}