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-11-07 09:01:54 UTC",
      "updated_at": "2019-11-07 09:01:54 UTC",
      "id": 16,
      "trendable_type": "FactName",
      "trendable_id": 9,
      "fact_name": "fact153",
      "type": "FactTrend",
      "name": "trend9",
      "label": "trend9"
    },
    {
      "created_at": "2019-11-07 09:01:54 UTC",
      "updated_at": "2019-11-07 09:01:54 UTC",
      "id": 12,
      "trendable_type": "Environment",
      "trendable_id": 93,
      "fact_name": "fact",
      "type": "ForemanTrend",
      "name": "trend8",
      "label": "Environment"
    }
  ]
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

Validations:

  • Must be a Integer


GET /api/trends/:id
Show a trend

Examples

GET /api/trends/7
200
{
  "created_at": "2019-11-07 09:01:54 UTC",
  "updated_at": "2019-11-07 09:01:54 UTC",
  "id": 7,
  "trendable_type": "Environment",
  "trendable_id": 91,
  "fact_name": "fact",
  "type": "ForemanTrend",
  "name": "trend6",
  "label": "Environment"
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

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

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

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/32
{
  "trend": {}
}
200
{
  "id": 32,
  "trendable_type": "Environment",
  "trendable_id": 99,
  "name": "trend14",
  "fact_value": null,
  "fact_name": "fact",
  "created_at": "2019-11-07T09:01:55.164Z",
  "updated_at": "2019-11-07T09:01:55.164Z"
}

Params

Param Name Description
location_id
Optional

Set the current location context for the request

Validations:

  • Must be a Integer

organization_id
Optional

Set the current organization context for the request

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.