API Reference

Listing and filtering

Almost every entity in Rainex can be listed with filtering and pagination.

Every entity that can be listed has 2 specific endpoints serving that purpose: metadata endpoint and listing endpoint.

📘

Metadata endpoint is a GET endpoint that returns a set of fields of an entity. These fields can be used for filtration and pagination.

📘

Listing endpoint is a POST endpoint where you send filtration and pagination options and get a set of entity instances that match your criteria.

Metadata endpoint response model is the following:

[  
{  
	fieldType: string, //type of the field that can be used for filtration  
	fieldName: string, //the name of the field  
	label: string, //display name of the field, i.e. how it’s named in your control panel  
	operators: string[], //set of operators that can be used with this field for filtration. For example, for fields with DateTime fieldType the operators will be "eq" (equal), "neq"(not equal), "gt"(greater than, i.e. later that), "gte" (greater than or equal, i.e. later than or equal), "lt" (less than, i.e. earlier than), "lte"(less than or equal, i.e. earlier than or equal)  
	items: { value: string }[] //array of objects with the only field “value”. Returned for fields that can accept a limited set of values and shows what those values are. For example, for addons entity for field “channel” which can be only “Web”, “PlayStore” or “AppStore” the “items” field will be [ { value: “Web” }, { value: “PlayStore”}, { value: “AppStore” } ]  
}  
]

Listing endpoint request model is the following:

{  
  "filters": [  
    {  
      "field": string, //the name of the field that used for filtration  
      "operator": string, //the operator used for field value comparison. The set of possible operators for each field is returned in metadata endpoint request  
      "value": string, //the target value of the field used for filtration  
      "logic": string //logic of combining this filter with the next filter, in case there are more than 1. Can be any valid SQL filter combining operator, like OR or AND.  
    }  
  ],  
  "sortField": string, //the field to use for sorting the results.  
  "sortKind": string, //the order of sorting the results. Can be “Asc” (ascending) or “Desc” (descending).  
  "offset": 0, //how many starting instances to skip in the results. Set to 0, null or omit for no skipping  
  "limit": 0 //how many instances must be returned. Set to null or omit to return everything left.  
}

A response to the listing endpoint will contain an array of entities. These entities’ models will be the same as the model in “get by id” endpoints. For example, a response to the addons listing endpoint will be an array of the following models:

{  
  "id": "string",  
  "name": "string",  
  "externalName": "string",  
  "description": "string",  
  "status": "Undefined",  
  "productFamilyId": "string",  
  "channel": "Undefined",  
  "archivedAt": "2022-11-24T12:15:02.143Z",  
  "isShippable": true,  
  "isGiftable": true,  
  "giftClaimRedirectUrl": "string",  
  "usageCalculation": "Undefined",  
  "metadata": {  
    "additionalProp1": "string",  
    "additionalProp2": "string",  
    "additionalProp3": "string"  
  },  
  "unit": "string",  
  "metered": true,  
  "enabledInPortal": true,  
  "addonId": "string",  
  "updatedAt": "2022-11-24T12:15:02.143Z",  
  "createdAt": "2022-11-24T12:15:02.143Z"  
}