Does Transactional APIs supports data query?

Hi, I'm new to the Anaplan platform and I'm working on Transactional APIs to consume data from a model and view.

I'm using the API collection from the docs and the following endpoint to get data - {{int_v2_base_url}}/2/0/models/{{modelId}}/views/{{viewId}}/data?format=v1

I'm not able to find any examples online on how can I query/filter the data via the api so that I don't get all of the data back from view but only the ones that I need.

One example is where I have different shops with unique code and I'd like to get data from the view for a particular shop or shops that matches the query criteria in the request.

Any help will be much appreciated.

Answers

  • Option 1:
    Create a saved view in Anaplan that has the specific filter you need. You or your team's model builder can set up a dynamic & complex logic and put it in a single Boolean filter line item. It will be easier to understand and change it if needed.

    Option 2:
    Have you tried something like this?


    {{int_v2_base_url}}/2/0/models/{{modelId}}/views/{{viewId}}/data?format=v1&filter=shopCode eq 'SHOP123' and status eq 'Active'

    shopcode = line item that has the shop codes

    status = line item that shows the status of shops

    eq = equals

    gt = greater than

    lt = less than

  • Hi @seymatas1,

    Thanks for your response to my query.

    I have asked a model builder in another team to add a filter to the view, enabling me to consume the data by using Option 2 mentioned above.

    Could you please provide any resources to how to add a filter to the view to support Option 2?

    I tried using the Anaplan docs but had no luck!

    TIA

  • seymatas1
    edited June 24

    Reading OEG articles before you start building can benefit your organization's Anaplan implementation. OEG (Operational Excellence Group) finds and shares the best practices for model building.

    You can also find different sources and article types in Anaplan support.

  • Hi @seymatas1,

    Thanks for your response.

    With the linked page, I was able to add a filter for the shopCode column for the view. However, this filter feature only supports a hardcoded value e.g. 101. Then I saved it as a view.

    When I request the data via the endpoint that you have mentioned, I get the response for a shop with code 101 but not for others e.g. 102, 103.

    It seems like Anaplan needs to create a separate view for each filtered value like 101, 102, 103, etc. which is not ideal as with this logic, we will end up having many views just for the usage of filtering by shopCode.

    1. Is there any other way to have only one view and filter the data by code/id row/column?
    2. Is there any other way via transactional API using which I can get data for each shop instead of fetching one API response?

  • seymatas1
    edited June 25

    Is there any other way to have only one view and filter the data by code/id row/column?

    Yes.

    1. Create a Boolean line item in the system (SYS or PROP) module.
    2. There are three ways to populate the Boolean line item:
    • Manually select the shops that you want to filter.
    • Import into the Boolean from a csv file, from another module, or through API.
    • Write a formula with the logic. For example, IF shop is a distribution center TRUE else FALSE

    Note: If this is a one-time action, you can select the easiest way to populate the Boolean. If this is a repeating process, you should setup the maintenance of that Boolean and automate it.

    3. Filter based on that Boolean line item instead of creating multiple saved views for each shop.
    Screenshot 1: PROP01 Shop Properties Grid View


    Screenshot 2: PROP01 Shop Properties Blueprint View

  • @seymatas1,

    That will be very helpful, thanks.

    I'd like to fetch the shop information based on the code via the API so it can be for any shop.

    So,

    • Manually select the shops that you want to filter. - it can be any shop data by the api based on the shop code.
    • Import into the Boolean from a csv file or from another module that has to be filtered shops' information.
    • Write a formula with the logic. For example, IF shop is a distribution center TRUE else FALSE

    I'm not sure about the last two options and the use case is to fetch any shop's data by the shop code on demand by consuming the transactional API. It is not going to be based on logic, the code will have to come in the request from the consumer, i.e. postman client or a .net API service later.

  • seymatas1
    edited June 25

    If I understand correctly, you should have a two-step process:

    Step 1 PUT: Populate the Boolean filter in Anaplan through the shop codes from the consumer through transactional API.

    Step 2 GET: Use the saved view from Anaplan that uses the Boolean filter to query those specific shops through transactional API.