Unable to add BOM Item using REST API, get response - 500 Internal server error

Unable to add BOM Item using REST API, get response - 500 Internal server error

krister.sjoberg
Contributor Contributor
1,939 Views
8 Replies
Message 1 of 9

Unable to add BOM Item using REST API, get response - 500 Internal server error

krister.sjoberg
Contributor
Contributor

I in the progress of creating an application in .NET that will create Items and Item BOMs in PLM360 using the REST v1 API. I have succeeded in creating new and updating existing the Item's and also to handle the Lifecycle transitions of the Item's. When I came to the stage where I started implementing the functionallity for handling the BOM I ran into some problems right away. Using a small testapplication I create a new Assembly Item and a new Part Item and release both of them, so far no problems. When I then try to add the Part to Assembly Item's BOM I get a 500 Internal Server Error in response everytime.
The request I send to the server looks as follws:

Request Header:
=====================================
POST https://[XXXXXXXX].autodeskplm360.net/api/rest/v1/workspaces/57/items/8352/boms.xml HTTP/1.1
User-Agent: System.Net.HttpWebRequest (PLM.WebServices; .NET 4.0.30319.42000; TestApp)
Accept: application/xml
Content-Type: application/xml
Host: XXXXXXXX.autodeskplm360.net
Cookie: JSESSIONID=849577F7BC0573CB2888FC4215E157AC; PLM360LBR=b3JpZ2luLXByLWVudjAxLXBsbXdlYjAzLmF1dG9kZXNrcGxtMzYwLm5ldA==
Content-Length: 256
Expect: 100-continue


Request Body
================================================================
<?xml version="1.0"?>
<boms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <bom>
    <bomDmsID>8354</bomDmsID>
    <itemNumber>1</itemNumber>
    <itemQuantity>10</itemQuantity>
  </bom>
</boms>

I can mention that I have tried using JSON instead of XML, but the outcome is the same, 500 Internal Server Error!!
I have also tried to change the request data in Fiddler but no luck there either, still the same result!

This is the only thing that is not working right now, reading workspace data, creating/updating Items etc.. is working perfectly!

Does anyone have an idea of what I am doing wrong or what can cause this behavior?

Thanks
Krister

Accepted solutions (3)
1,940 Views
8 Replies
Replies (8)
Message 2 of 9

gasevsm
Alumni
Alumni

hi, let's start with this please: do you have required fields on the BOM tab? if so, my recommendation is to follow request example 2 on this page where it specifies the required fields and values. http://help.autodesk.com/view/PLM/ENU/?guid=GUID-A9F7CB28-1101-4656-A39D-3A62F3ACDC13

hope this helps,


Martin Gasevski | Fusion 360 Team Product Manager
0 Likes
Message 3 of 9

krister.sjoberg
Contributor
Contributor

Hi Martin,

 

I don't think that is the problem. Just to be sure I removed pretty much all columns and I don't think that any of the remaining fields are required. The testrun resulted in the same error 500.

I have attached an image showing the BOM view that is used. Also, I don't have any custom BOM fields in use for the Workspace BOM.

 

/Krister

 

 

0 Likes
Message 4 of 9

gasevsm
Alumni
Alumni
Accepted solution
Thx for the pic. This helped.
Do you see that unassigned refdes field on the left? Please edit it and remove the UNIQUE validator. Save and try your API call again. HTH,
--
Martin Gasevski | Product Manager | Autodesk PLM 360

Martin Gasevski | Fusion 360 Team Product Manager
0 Likes
Message 5 of 9

krister.sjoberg
Contributor
Contributor
Accepted solution

Thanks Martin!

 

This solved the problem!. Why is it that unassigned field can effects the POST request for BOM? I could understand it if where assigned and used.

 

Anyway, thanks for the quick help!

 

/Krister

0 Likes
Message 6 of 9

gasevsm
Alumni
Alumni

ah, its not really unnasigned for bom tab, not for tab's edit mode. the unnasigned/assigned depiction works well for itemdetails - fields are truly unnassigned. for this user interface of PLM 360, the bom views let you configure different fields you wish shown in view mode to various consumers of that bom. anyhow, immediately recognized that ootb "Reference Designator" field and am aware it has a unique validation ootb. The UI isn't affected by this issue, but we are aware that this validation is conflicting with ability to add components to BOM tab via the API. While we're trying to address the problem, a simple workaround is to remove unique validator from it. Sorry for caused inconvenience. hope you are good now.


Martin Gasevski | Fusion 360 Team Product Manager
0 Likes
Message 7 of 9

krister.sjoberg
Contributor
Contributor

Hi Martin,

 

I have an additional question regarding add BOM item using the API and custom BOM Fields. As I understand it from the API help you should be able to add data to custom BOM Fields using the v1 API, right? When I try this, no data is enterd in that custom Field. The BOM is created correctly with with the correct quantity etc..

The custom Field has no required value, in fact, no validati at all, as you can se in the second image below. At the bottom I have inserted a short snippet of the XML input for the upload of the BOM. For thees <fields>..</fileds> section I have tried to diffrent approches with the <entry>...</entry> tag and without with the same result. 

Any idea what I'm doing wrong here?

 

The BOM view looks like this, where the Field "BOM Test" is the custom Field

BOMView.png

 

 

and the Field definition...

Field.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The XML input looks like this:

 

<boms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <bom>
    <bomDmsID>822</bomDmsID>
    <itemQuantity>2</itemQuantity>
    <isPinned>false</isPinned>
    <fields>
      <entry>
        <name>BOM_TEST</name>
        <vaule>Rad 1</vaule>
      </entry>
    </fields>
   </bom>
   <bom>
    <bomDmsID>824</bomDmsID>
    <itemQuantity>2</itemQuantity>
    <isPinned>false</isPinned>
    <fields>
      <entry>
        <name>BOM_TEST</name>
        <vaule>Rad 2</vaule>
     </entry>
   </fields>
  </bom>
</boms>

 

 

Thanks 

Krister

Message 8 of 9

gasevsm
Alumni
Alumni
Accepted solution
Hi, Let's correct the typo to and reevaluate if call is still not succeeding. Kindly post results please once retest. Thanks,
--
Martin Gasevski | Product Manager | Autodesk PLM 360

Martin Gasevski | Fusion 360 Team Product Manager
0 Likes
Message 9 of 9

Anonymous
Not applicable

same problem how to solve this

 

0 Likes