GET /api/trends
List of trends counters

Examples

GET /api/trends
200
{
  "total": 2,
  "subtotal": 2,
  "page": 1,
  "per_page": 20,
  "search": null,
  "sort": {
    "by": null,
    "order": null
  },
  "results": [
    {
      "created_at": "2019-09-11 14:41:07 UTC",
      "updated_at": "2019-09-11 14:41:07 UTC",
      "id": 31,
      "trendable_type": "FactName",
      "trendable_id": 15,
      "fact_name": "fact122",
      "type": "FactTrend",
      "name": "trend10",
      "label": "trend10"
    },
    {
      "created_at": "2019-09-11 14:41:07 UTC",
      "updated_at": "2019-09-11 14:41:07 UTC",
      "id": 27,
      "trendable_type": "Environment",
      "trendable_id": 9,
      "fact_name": "fact",
      "type": "ForemanTrend",
      "name": "trend9",
      "label": "Environment"
    }
  ]
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer


GET /api/trends/:id
Show a trend

Examples

GET /api/trends/32
200
{
  "created_at": "2019-09-11 14:41:07 UTC",
  "updated_at": "2019-09-11 14:41:07 UTC",
  "id": 32,
  "trendable_type": "Environment",
  "trendable_id": 11,
  "fact_name": "fact",
  "type": "ForemanTrend",
  "name": "trend11",
  "label": "Environment"
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

trend_id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.


POST /api/trends
Create a trend counter

Examples

POST /api/trends
{
  "trend": {
    "trendable_type": "NotExists"
  }
}
500
{
  "error": {
    "message": "uninitialized constant NotExists"
  }
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

trendable_type
required

Validations:

  • Must be a String

fact_name
optional

Validations:

  • Must be a String

name
optional

Validations:

  • Must be a String


DELETE /api/trends/:id
Delete a trend counter

Examples

DELETE /api/trends/22
{
  "trend": {}
}
200
{
  "id": 22,
  "trendable_type": "Environment",
  "trendable_id": 7,
  "name": "trend7",
  "fact_value": null,
  "fact_name": "fact",
  "created_at": "2019-09-11T14:41:07.646Z",
  "updated_at": "2019-09-11T14:41:07.646Z"
}

Params

Param name Description
location_id
optional

Scope by locations

Validations:

  • Must be a Integer

organization_id
optional

Scope by organizations

Validations:

  • Must be a Integer

id
required

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hypen(-) with no leading or trailing space.