How to get a bom from teamcenter API

Hello,

I’m trying to get a bom with the teamcenter api with the url {{TC_URL}}/JsonRestServices/Allocations-2007-01-Allocation/getBOMViews

have somebody already did this kind of operation ?

thank you

Hey @aviation-pilot-68472 :wave:

Welcome to the Postman Community! :postman:

Are you talking about this API?

https://docs.plm.automation.siemens.com/docs/tc_mx/2.1/en_US/TcConnectorAPI/tc13.0.0.0.2020060500/index.html#operation=getBOMViews

What’s happening when you’re calling it? Are you able to successfully call any other routes?

I have absolutely no idea about this API - Just putting it out there :grimacing:

Hello @danny-dainton
Thank you for your reply, yes i’m exactly talking about this API.
i can already have the properties from an item for example :

{
    "header": {
        "state": {},
        "policy": {}
    },
    "body": {
        "infos": [
            {
                "itemId": "116022"
            }
        ],
        "nRev": -1,
        "pref": {
            "prefs": []
        }
    }
}

with this response :

{
    ".QName": "http://teamcenter.com/Schemas/Core/2007-01/DataManagement.GetItemFromIdResponse",
    "output": [
        {
            "item": {
                "uid": "BePAAAUvZeEWEB",
                "className": "EVE4_Engineering",
                "type": "EVE4_Engineering"
            },
            "itemRevOutput": [
                {
                    "itemRevision": {
                        "uid": "BiDAAAUvZeEWEB",
                        "className": "EVE4_EngineeringRevision",
                        "type": "EVE4_EngineeringRevision"
                    },
                    "datasets": [
                        {
                            "uid": "SYLAAAUvZeEWEB",
                            "className": "Dataset",
                            "type": "UGMASTER"
                        }
                    ]
                }
            ]
        }
    ],
    "ServiceData": {
        "plain": [
            "BePAAAUvZeEWEB",
            "SYLAAAUvZeEWEB",
            "BiDAAAUvZeEWEB"
        ],
        "modelObjects": {
            "BePAAAUvZeEWEB": {
                "objectID": "BePAAAUvZeEWEB",
                "uid": "BePAAAUvZeEWEB",
                "className": "EVE4_Engineering",
                "type": "EVE4_Engineering",
                "props": {}
            },
            "SYLAAAUvZeEWEB": {
                "objectID": "SYLAAAUvZeEWEB",
                "uid": "SYLAAAUvZeEWEB",
                "className": "Dataset",
                "type": "UGMASTER",
                "props": {}
            },
            "BiDAAAUvZeEWEB": {
                "objectID": "BiDAAAUvZeEWEB",
                "uid": "BiDAAAUvZeEWEB",
                "className": "EVE4_EngineeringRevision",
                "type": "EVE4_EngineeringRevision",
                "props": {}
            }
        }
    }
}

but when i try {{TC_URL}}/JsonRestServices/Allocations-2007-01-Allocation/getBOMViews with this code :

{
    "header": {
        "state": {},
        "policy": {}
    },
    "body": {
        "bomView": {
            "uid": "R_EAAAUvZeEWEB"
        }
    }
}

i have this response :

{
    ".QName": "http://teamcenter.com/Schemas/Soa/2006-03/Base.ServiceData",
    "modelObjects": {},
    "partialErrors": [
        {
            "errorValues": [
                {
                    "message": "Invalid Tag NULL object (in object) - the requested object does not exist",
                    "code": 7007,
                    "level": 3
                }
            ]
        }
    ]
}

I have no idea on how to build the body for this call… :sweat_smile:

This is from the documentation and it appears to require a simple JSON body. I hope you know which value needs to go in place of the IModelObject string. Is it the objectID or a uid? Sounds like its one of the elements under ServiceData.modelObjects in your initial response. (If you don’t know, try all of them as it should only be a case of updating the string value and testing).

getBOMViews

Description:
In allocation functionality in context of an AllocationMapRevision object, allocations are created between two or more product structures. This operation returns the PSBOMView objects associated to the given AllocationMapRevision object.

Use Cases:
For the given AllocationMapRevision object, the PSBOMView objects associated to the AllocationWindow object to create allocations are identified and returned.

Returns:
A list of PSBOMView objects with a given AllocationMapRevision as context is returned in the plain objects of ServiceData. Any errors during the operation will be returned in the Partial Errors of ServiceData element.

Library: Allocations

Service: Allocation

Year: 2007-01

Url: Allocations-2007-01-Allocation/getBOMViews

Soa Dependency Inclusion: “Teamcenter.Soa.Allocations._2007_01.Allocation.getBOMViews”

Request:

{
     allocationContext: "IModelObject"
}

Response:

“IServiceData”

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.