**CM FFT**
=============


**CM FFT Peaks**
+++++++++++++++++++

.. http:get:: /_cm/fft/_peaks


    **Description** Fetch FFT spectrum peak for the monitor and axis.

    **Http Method** GET

    **ENDPOINT** ``/_cm/fft/_peaks``

    **Request Header** ``Authorization`` `Basic <token>`

    **Request Parameters**

    URL Parameters

        - ``monitor_id`` (string, *required*): The ID of the associated monitor.
        - ``tag`` (string, *required*): The tag for which FFT Peaks are requested.
        - ``axis`` (string, *required*): The axis for which FFT Peaks are requested.
        - ``timestamp`` (string, *required*): The timestamp for which FFT Peaks are requested.

    **Sample Request**

        .. code-block:: sh

            curl --location 'https://app.4pointx.com/_cm/fft/_peaks?monitor_id=06a5a783-5ca1-4293-a4e9-510566ec4f38&tag=velocity&axis=X&timestamp=1652831633000' \
            --header 'Authorization: Basic <token>'
  
    **Sample Response**

    Success

        .. sourcecode:: json

            [
                {
                    "freq": 24.41,
                    "tag_value": 0.31,
                    "fundamental_freq": 0.1
                },
                {
                    "freq": 26.04,
                    "tag_value": 0.33,
                    "fundamental_freq": 1
                },
                {
                    "freq": 37.43,
                    "tag_value": 0.07,
                    "fundamental_freq": 1.5
                },
                {
                    "freq": 48.82,
                    "tag_value": 0.16,
                    "fundamental_freq": 2
                },
                {
                    "freq": 74.86,
                    "tag_value": 0.07,
                    "fundamental_freq": 3
                },
                {
                    "freq": 100.9,
                    "tag_value": 0.07,
                    "fundamental_freq": 4
                }
            ]

    Error

        .. sourcecode:: json

            {
                "error": {
                    "status": 401,
                    "message": "Unauthorized access to module by general-user"
                }
            }

        .. sourcecode:: json

            {
                "error": {
                    "status": 400,
                    "message": "Invalid Monitor Id"
                }
            }

        .. sourcecode:: json

            {
                "error": {
                    "status": 400,
                    "message": "Invalid Asset Id"
                }
            }



**CM Asset Fault Summary**
+++++++++++++++++++++++++++

.. http:get:: /_cm/fft/_summary

    **Description** Fetch the fault summary for the asset.

    **Http Method** GET

    **ENDPOINT** ``/_cm/fft/_summary``

    **Request Header** ``Authorization`` `Basic <token>`

    **Request Parameters**

    URL Parameters

        - ``asset_id`` (string, *required*): The ID of the associated asset.

    **Sample Request**

        .. code-block:: sh

           curl --location 'https://app.4pointx.com/_cm/fft/_summary?asset_id=0060d999-5c24-4957-ade7-f0e1b9d52e50' \
            --header 'Authorization: Basic <token>'
  

    **Sample Response**

    Success

        .. sourcecode:: json

            [
                {
                    "monitor name": "R1SD Cimcon NDE",
                    "summary": "low level of imbalance detected in X axis.",
                    "Timestamp": "2023-11-30T12:01:00"
                }
            ]

    Error

        .. sourcecode:: json

            {
                "error": {
                    "status": 401,
                    "message": "Unauthorized access to module by general-user"
                }
            }


        .. sourcecode:: json

            {
                "error": {
                    "status": 400,
                    "message": "Invalid Asset Id"
                }
            }


**CM FFT Spectrum**
+++++++++++++++++++++

.. http:get:: /_cm/fft/_spectrum

    **Description** Fetch FFT spectrum for given monitor, tag, timestamp and axis.

    **Http Method** GET

    **ENDPOINT** ``/_cm/fft/_spectrum``

    **Request Header** ``Authorization`` `Basic <token>`

    **Request Parameters**

    URL Parameters

        - ``monitor_id`` (string, *required*): The ID of the associated monitor.
        - ``tag`` (string, *required*): The tag for which FFT Spectrum is requested.
        - ``axis`` (string, *required*): The axis for which FFT Spectrum is requested.
        - ``timestamp`` (string, *required*): The timestamp for which FFT Spectrum is requested.

    **Sample Request**

        .. code-block:: sh

            curl --location 'https://app.4pointx.com/_cm/fft/_spectrum?monitor_id=06a5a783-5ca1-4293-a4e9-510566ec4f38&tag=velocity&axis=X&timestamp=1652831633000' \
            --header 'Authorization: Basic <token>'
  
    **Sample Response**

    Success

        .. sourcecode:: json

            [
                {
                    "freq": 37.432499999999976,
                    "tag_value": 0.021,
                    "peak": true
                },
                {
                    "freq": 40.68749999999997,
                    "tag_value": 0.036,
                    "peak": true
                },
                {
                    "freq": 42.31499999999997,
                    "tag_value": 0.01,
                    "peak": true
                },
                {
                    "freq": 43.12874999999997,
                    "tag_value": 0.008,
                    "peak": true
                },
                .
                .
            ]

    Error

        .. sourcecode:: json

            {
                "error": {
                    "status": 401,
                    "message": "Unauthorized access to module by general-user"
                }
            }

        .. sourcecode:: json

            {
                "error": {
                    "status": 400,
                    "message": "Invalid Monitor Id"
                }
            }



**CM FFT Spectrum Timestamps**
++++++++++++++++++++++++++++++

.. http:get:: /_cm/fft/_timestamps


    **Description** Fetch timestamps for which FFT spectrum is available for a monitor.

    **Http Method** GET

    **ENDPOINT** ``/_cm/fft/_timestamps``

    **Request Header** ``Authorization`` `Basic <token>`

    **Request Parameters**

    URL Parameters

        - ``monitor_id`` (string, *required*): The ID of the associated monitor.

    **Sample Request**

        .. code-block:: sh

            curl --location 'https://app.4pointx.com/_cm/fft/_timestamps?monitor_id=06a5a783-5ca1-4293-a4e9-510566ec4f38' \
            --header 'Authorization: Basic <token>'
  
    **Sample Response**

    Success

        .. sourcecode:: json

            [
                1652831633000,
                1652831580000,
                1652814060000,
                1652787586000
            ]

    Error

        .. sourcecode:: json

            {
                "error": {
                    "status": 401,
                    "message": "Unauthorized access to module by general-user"
                }
            }

        .. sourcecode:: json

            {
                "error": {
                    "status": 400,
                    "message": "Invalid Monitor Id"
                }
            }