Method Community

 

how to get record from particular range of date ( last month till today date )

Last post 09-12-2024 2:07 PM by Method_Inderdeep. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-04-2024 4:41 PM

    how to get record from particular range of date ( last month till today date )

    I am using  Azure ADF services   under Rest serverce activities :     


    i want to get last month till today date record , how do i put into URL endpoint

    @{concat('https://rest.method.me/api/v1/tables/SalesOrder?filter=TxnDate ge ''', formatDateTime(utcNow(), 'yyyy-MM-dd'), '''&orderby=TxnDate desc&$top=1')
    }

    lets say I want to get last month record along with till today and i try with this url endpoint but its give me error : 

    @{concat('https://rest.method.me/api/v1/tables/SalesOrder?filter=TxnDate ge ''', formatDateTime(addMonths(startOfMonth(utcNow()), -1), 'yyyy-MM-dd'), ''' and TxnDate le ''', formatDateTime(utcNow(), 'yyyy-MM-dd'), '''&orderby=TxnDate desc&$top=1')} 

    would you please send me the structure regarding that so that i can use it. 

  • 09-06-2024 9:57 AM In reply to

    Re: how to get record from particular range of date ( last month till today date )

    Hi athakur,

    Could you please share the error with me? Could you also share the request and response body from the postman, it will help me guide you better.

    - Inder

  • 09-10-2024 3:02 PM In reply to

    Re: how to get record from particular range of date ( last month till today date )

    error I got : 

    Failed to decrypt sub-resource 'None' payload on cloud with error: Failed to decrypt sub-resource payload {
    "name": "Linked_SalesOrder",
    "properties": {
    "description": "Calling Salesorder_Api ",
    "annotations": [,
    "type": "RestService",
    "typeProperties": {
    "url": "********************",
    "enableServerCertificateValidation": "********************",
    "authenticationType": "********************",
    "encryptedCredential": "********************"
    }
    }
    } and error is: Failed to validate the signature because the content is tampered, the expect context is '{"url":"@{concat('https://rest.method.me/api/v1/tables/SalesOrder?filter=TxnDate ge ''', formatDateTime(addDays(utcNow(), -7), 'yyyy-MM-dd'), ''' and TxnDate le ''', formatDateTime(utcNow(), 'yyyy-MM-dd'), '''&orderby=TxnDate desc&$top=1')}","authenticationType":"Anonymous","dataFactoryName":"Amlon"}' and the runtime context is '{"url":"https://rest.method.me/api/v1/tables/SalesOrder?filter=TxnDate ge '2024-09-03' and TxnDate le '2024-09-10'&orderby=TxnDate desc&$top=1","authenticationType":"Anonymous","dataFactoryName":"Amlon"}'.., status code: BadRequest.

  • 09-12-2024 2:07 PM In reply to

    Re: how to get record from particular range of date ( last month till today date )

    I just tried the same URL and it works for me. Looks like there is an issue in some external tool, probably Azure data factory, that you are using. Can you confirm that the request url format is :
    https://rest.method.me/api/v1/tables/SalesOrder?filter=TxnDate ge 'yyyy-MM-dd' and TxnDate le 'yyyy-MM-dd'&orderby=TxnDate desc&$top=1

Page 1 of 1 (4 items)