Help Center

Catalogs

GET /catalogs/{catalog-id}

This method returns a catalog with all its elements.

GET https://api.pyrus.com/v4/catalogs/422

Response body

{
  "catalog_id": 6625,
  "name": "Clients",
  "catalog_headers": [
    {
      "name": "Name",
      "type": "text"
    },
    {
      "name": "Company",
      "type": "text"
    }
  ],
  "items": [
    {
      "item_id": 15200,
      "values": [
        "Reatha Middendorf",
        "Acme, inc."
      ]
    },
    {
      "item_id": 15201,
      "values": [
        "Daedra Ullrich",
        "Widget Corp"
      ]
    },
    {
      "item_id": 15202,
      "values": [
        "Andy Mahn",
        "123 Warehousing"
      ]
    }
  ]
}

curl

curl -X GET \
  https://api.pyrus.com/v4/catalogs/422 \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json'

GET /catalogs

This method returns all catalogs without all its elements.

GET https://api.pyrus.com/v4/catalogs

Response body

{
    "catalogs": [
        {
            "catalog_id": 31816,
            "name": "Catalog1",
            "version": 151199,
            "deleted": false,
            "supervisors": [
                1731
            ],
            "external_version": 0
        },
        {
            "catalog_id": 31817,
            "name": "Catalog2",
            "version": 109104,
            "deleted": false,
            "external_version": 0
        }
]
}

curl

curl -X GET \
  https://api.pyrus.com/v4/catalogs \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json'

PUT /catalogs

Create a catalog. This method returns a catalog with all its elements.

PUT https://api.pyrus.com/v4/catalogs

Request body

{
  "name": "Clients",
  "catalog_headers": [
    "Name",
    "Company"
  ],
  "items": [
    {
      "values": [
        "Reatha Middendorf",
        "Acme, inc."
      ]
    },
    {
      "values": [
        "Daedra Ullrich",
        "Widget Corp"
      ]
    },
    {
      "values": [
        "Andy Mahn",
        "123 Warehousing"
      ]
    }
  ]
}

Response body

{
  "catalog_id": 6625,
  "name": "Clients",
  "catalog_headers": [
    {
      "name": "Name",
      "type": "text"
    },
    {
      "name": "Company",
      "type": "text"
    }
  ],
  "items": [
    {
      "item_id": 15200,
      "values": [
        "Reatha Middendorf",
        "Acme, inc."
      ]
    },
    {
      "item_id": 15201,
      "values": [
        "Daedra Ullrich",
        "Widget Corp"
      ]
    },
    {
      "item_id": 15202,
      "values": [
        "Andy Mahn",
        "123 Warehousing"
      ]
    }
  ]
}

curl

curl -X PUT \
  https://api.pyrus.com/v4/catalogs/ \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Clients",
  "catalog_headers": [
    "Name",
    "Company"
  ],
  "items": [
    {
      "values": [
        "Reatha Middendorf",
        "Acme, inc."
      ]
    },
    {
      "values": [
        "Daedra Ullrich",
        "Widget Corp"
      ]
    },
    {
      "values": [
        "Andy Mahn",
        "123 Warehousing"
      ]
    }
  ]
}'

POST /catalogs/{catalog-id}

Sync a catalog. This method updates catalog headers and items. You must define all the values and text columns that need to remain in the catalog. All unspecified items and text columns will be deleted. This method only changes the values. To do this, you must pass it explicitly in the list of columns. You can not add or delete workflow columns using this method. The first column of the catalog is the key parameter. Therefore, its name cannot be changed. This method returns a list of items that have been added, modified, or deleted.

POST https://api.pyrus.com/v4/catalogs/6625

Request body

{
  "apply": true,
  "catalog_headers": [
    "Name",
    "Company"
  ],
  "items": [
    {
      "values": [
        "Reatha Middendorf",
        "Acme"
      ]
    },
    {
      "values": [
        "Daedra Ullrich",
        "Widget Corp"
      ]
    },
    {
      "values": [
        "Jean Overturf",
        "Demo Company"
      ]
    }
  ]
}

Response body

{
  "apply": true,
  "added": [
    {
      "item_id": 15205,
      "values": [
        "Jean Overturf",
        "Demo Company"
      ]
    }
  ],
  "deleted": [
    {
      "item_id": 15202,
      "values": [
        "Andy Mahn",
        "123 Warehousing"
      ]
    }
  ],
  "updated": [
    {
      "item_id": 15200,
      "values": [
        "Reatha Middendorf",
        "Acme"
      ]
    }
  ],
  "catalog_headers": [
    {
      "name": "Name",
      "type": "text"
    },
    {
      "name": "Customer Company",
      "type": "text"
    }
  ]
}

curl

curl -X POST \
  https://api.pyrus.com/v4/catalogs/6625 \
  -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
  -H 'Content-Type: application/json' \
  -d '{
  "apply": true,
  "catalog_headers": [
    "Name",
    "Company"
  ],
  "items": [
    {
      "values": [
        "Reatha Middendorf",
        "Acme"
      ]
    },
    {
      "values": [
        "Daedra Ullrich",
        "Widget Corp"
      ]
    },
    {
      "values": [
        "Jean Overturf",
        "Demo Company"
      ]
    }
  ]
}'

Parameters

applyDefine this as true if you want to apply changes, or false if you want to calculate which items will be added/deleted/updated.
catalog_headersAn array of catalog headers. All unspecified text columns will be deleted.
itemsAn array of catalog items. All unspecified items will be deleted.

POST /catalogs/{catalog-id}/diff

Change catalog items. This method allows you to insert new catalog items, modify or delete existing ones. The first column of the catalog is the key parameter. To insert or modify a row (also called as upsert) please pass an array of values for each item. To delete items you need only an array of keys. This method returns a list of items that have been added, modified, or deleted (it’s the same as a sync catalog method does).

POST https://api.pyrus.com/v4/catalogs/6625/diff

Request body

{
    "upsert": [
    {
        "values": [
            "Reatha Middendorf",
            "Acme"
        ]
    },
    {
        "values": [
            "Daedra Ullrich",
            "Widget Corp"
        ]
    }],
    "delete": ["Jean Overturf"]
}

Response body

{
    "apply": true,
    "added": [
    {
        "item_id": 24807,
        "values": [
            "Daedra Ullrich",
            "Widget Corp"
        ]
    }],
    "deleted": [
    {
        "item_id": 23169,
        "values": [
            "Jean Overturf",
            "Demo Company"
        ]
    }],
    "updated": [
    {
        "item_id": 23178,
        "values": [
            "Reatha Middendorf",
            "Acme"
        ]
    }],
    "catalog_headers": [
    {
        "name": "Name",
        "type": "text"
    },
    {
        "name": "Company name",
        "type": "text"
    }]
}

curl

curl -X POST \
 https://api.pyrus.com/v4/catalogs/6625/diff \
 -H 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
 -H 'Content-Type: application/json' \
 -d '{
 "upsert": [
 {
   "values": [
     "Reatha Middendorf",
     "Acme"
   ]
 },
 {
   "values": [
     "Daedra Ullrich",
     "Widget Corp"
   ]
 }],
 "delete": ["Jean Overturf"]
}'

Parameters

upsertAn array of catalog items to be inserted or modified.
deleteAn array of item keys (values of the first column) to be deleted.

Was this article helpful?