Can someone please give an example of an api search parameter string? Operators etc?


#1

I can not find any examples of how to use the search perameter. I see it is to be a string but what logical operators are supported etc? an example of how to select shipments made between certain dates would be awesome!


#2

The search string does not take operators, it searches on a given set of strings. You can search on the following fields:

  • shipment_id
  • assigned_to: company, name
  • shipment lines product: sku, name, comment
  • dropship_info: name, company
  • shipping_address: company, name

Example:
Ned Flanders owns The Leftorium, with a sales channel index of 1 in Ordoro. There is an order for Matt Groening. There are three items on the order, but the order is split into two shipments. A stripped down shape of the order looks like this:

{
	"order_id": "1-123",
	"shipping_address": {
		"name": "Matt Groening"
	},
	"shipments": [{
		"shipment_id": "1-123-1",
		"lines": [{
			"product": {
				"sku": 42-cs",
				"name": "Left Handed Corkscrew"
			}
		},
		{
			"product": {
				"sku": "13-sr",
				"name": "Left Handed String"
			}
		}]
	},
	{
		"shipment_id": "1-123-2",
		"lines": [{
			"product": {
				"sku": "99-sc",
				"name": "Left Handed Scissors"
			}
		}]
	}]
}

You want to search for the shipment with the scissors for Matt Groening, here’s a search string you could use. cart index on the shipment_id -1, shipping_address.name: last name only is simple enough Groening, line.product.name substring scissors.

/shipment?search=1-&search=Groening&search=scissors

The response would be:

{
	"shipment_id": "1-123-2",
	"lines": [{
		"product": {
			"sku": "99-sc",
			"name": "Left Handed Scissors"
		}
	}]
}