Solved

API call ProductStructureHandling giving an "Invalid key value" error for the parameter "BomType"

  • 7 December 2023
  • 5 replies
  • 134 views

Badge +2

I am trying to fetch the product structure items by passing six required parameters as shown below API call. This is as per the API Doc and am using PostMan with a valid bearer token.

 

https://w.sandbox.maiaspace/main/ifsapplications/projection/v1/ProductStructureHandling.svc/ProdStructures(Contract='{Contract}',PartNo='{PartNo}',EngChgLevel='{EngChgLevel}',BomType='{BomType}',AlternativeNo='{AlternativeNo}',LineItemNo={LineItemNo})

 

 

i am getting this error message, even though i put the required element 

{

    "error": {

        "code": "REQUEST_ERROR",

        "message": "Malformed Request.",

        "details": [

            {

                "code": "INVALID_KEY_VALUE",

                "message": "The key value 'BomType' is invalid."

            }

        ]

    }

}

BomType

Manufacturing

I am on IFS Cloud 23R1.

icon

Best answer by Tomas Ruderfelt 7 December 2023, 11:59

View original

5 replies

Userlevel 4
Badge +9

Can you add the input json and add odata-debug=json as a parameter?
 


As now we are flying a bit blind

Badge +2

Hello 

thank you for your answer

here is the rpart of the request to the odata-debug

 "request": {

        "method": "GET",

        "uri": "https://xxxxxxx/main/ifsapplications/projection/v1/ProductStructureHandling.svc/ProdStructureHeads(Contract='TEST1',PartNo='L1',EngChgLevel='1',BomType='M')?odata-debug=json",

        "protocol": "HTTP/1.1"

    },

    "response": {

        "status": {

            "code": "400",

            "info": "Bad Request"

        },

        "headers": {

            "OData-Version": "4.0",

            "Content-Type": "application/json"

        },

        "body": "{\"error\":{\"code\":\"REQUEST_ERROR\",\"message\":\"Malformed Request.\",\"details\":[{\"code\":\"INVALID_KEY_VALUE\",\"message\":\"The key value 'BomType' is invalid.\"}]}}"

    },

    "server": {

        "stacktrace": {

            "exceptions": [

                {

                    "class": "org.apache.olingo.server.core.uri.parser.UriParserSemanticException",

                    "message": "Value of key 'BomType' for entity 'IfsApp.ProductStructureHandling.ProdStructureHead' is not valid.",

                    "invocation": {

                        "class": "org.apache.olingo.server.core.uri.parser.ParserHelper",

                        "method": "keyValuePair",

                        "line": 450

                    }

                }

            ]

 

Does this help?

Userlevel 7
Badge +19

Since BomType is an enumeration you need to specify it like this in the URL to “ProductStructureHandling.svc/ProdStructures”:

…,BomType=IfsApp.ProductStructureHandling.ShopOrdCode'Manufacturing',...

Userlevel 7
Badge +19

That can be found in the metadata:

<Your URL>/main/ifsapplications/projection/v1/ProductStructureHandling.svc/$metadata
Badge +2

Thank you so much for you help 

Reply