Page 1 of 1

Tm1 rest api - Delete subset using $filter startswith()

Posted: Thu Sep 13, 2018 8:53 am
by kavitha2002
Hello Everyone,

I would like to delete a subset where the subset name startswith 'abc'.

I tried with

Code: Select all

http://host:8001/api/v1/Dimensions('Dimname')/Hierarchies('Dimname')/Subsets('fullname')
its working

But filter startswith below gives error.

Code: Select all

http://host:8001/api/v1/Dimensions('Dimname')/Hierarchies('Dimname')/Subsets($filter=startswith(Name, 'abc')) 
any idea of how to achieve this.

Thanks in advance

Re: Tm1 rest api - Delete subset using $filter startswith()

Posted: Mon Sep 17, 2018 12:12 pm
by bgregs
Taken from the OData site:

Code: Select all

	https://services.odata.org/Northwind/Northwind.svc/Customers?$filter=startswith(CompanyName, 'Alfr') eq true 
I have used this in the past and had success. Have you included your conditional check at the end of your call? (i.e. "eq true")

Re: Tm1 rest api - Delete subset using $filter startswith()

Posted: Mon Sep 17, 2018 1:20 pm
by kavitha2002
Hi Thanks for your response, but I tried in my end, but its not working...

I am performing a delete of subset.

Code: Select all

http://host:8001/api/v1/Dimensions('dimname')/Hierarchies('dimname')/Subsets?$filter=startswith(Name, 'abc') eq true
gives the below error

"message": "DELETE not allowed on a contained collection valued navigation property!"

Re: Tm1 rest api - Delete subset using $filter startswith()

Posted: Mon Sep 17, 2018 2:43 pm
by bgregs
Ahhh, I have never implemented that with a "delete" function on a subset. Interestingly enough I was able to find this post on one of the IBM forums:
Hi,

does the TM1 REST API allow DELETE operations with $filter on collections to delete all matching element, as specified in
https://www.oasis-open.org/committees/d ... nutes.html


I want to do something like this:
https://10.77.19.60:12354/api/v1/Dimens ... th(Name,'e')
Response from IBM:
Not yet Marius, ODATA-616 is targeted at the v4.01 OData specification. We have adopted a couple of patterns, extending what's allowed in OData v4, already in our implementation but this isn't one of them, not yet.
Looks like it's not available yet.

Link to forum discussion: https://www.ibm.com/developerworks/comm ... 7f4ad3e2f6

Re: Tm1 rest api - Delete subset using $filter startswith()

Posted: Wed Sep 19, 2018 6:11 am
by kavitha2002
Hello bgregs,

Thanks for your prompt response and your time:)