Forum Discussion

ef_akyazan's avatar
ef_akyazan
Level 3
2 years ago

About using "contains" in netbackup api

Hello,

I want to pull data with contains filter in /config/policies/ in netbackup api. but I am getting the following error. can you help me?

 

{  "errorCode": 9401,  "errorMessage": "The OData filter criteria is invalid.",  "attributeErrors": {},  "fileUploadErrors": [],  "errorDetails": [    "The filter is invalid."
  ]
}
  • ef_akyazan's avatar
    ef_akyazan
    2 years ago

    Hello again,

    I think I found the mistake I made while writing to you.

    1- contains (filterName, 'x')

    I noticed that I am getting an error because there is a space between contains and parenthesis. Thank you for your support.

     

     

  • Hi ef_akyazan 

    The error is reasonably clear and the syntax for the API call is quite particular as to case etc. You will need to post the API call you actually make for us to be able to help (remove any auth information from what you post). 

    Have you looked at the OData syntax requirements - the link is provided on the getting started page http://docs.oasis-open.org/odata/odata/v4.01/csprd01/part2-url-conventions/odata-v4.01-csprd01-part2-url-conventions.html#_Filter_System_Query

    Happy to try and help, but I need more information (getting the API call correct can be a challenge as the documentation isn't always 100% accurate). 

    Also provide the NetBackup version you are using - as the calls have some variationbetween versions. 

    Cheers
    David

    • ef_akyazan's avatar
      ef_akyazan
      Level 3

      Hello davidmoline ,

      Firstly, thank you for your reply. I checked the standards you mentioned. I tried the following way but it always showed the same error:

      1- contains (filterName, 'x')

      2-contains ('x, 'filterName )

      3-keyword contains  'x'

      4-contains keyword 'x'

      Thanks.

    • ef_akyazan's avatar
      ef_akyazan
      Level 3

      Hello again,

      I think I found the mistake I made while writing to you.

      1- contains (filterName, 'x')

      I noticed that I am getting an error because there is a space between contains and parenthesis. Thank you for your support.

       

       

  • Hi ef_akyazan 

    Also - if you can perform a similar filter operation via the WebUI, you should be able to use Chrome's Dev tools screen (F12) on the page to view the Network payload etc for the calls you make (it has helped me in the past to get the API syntax correct). 

    David