Back to Aligni.com

Add parts to a part revision as subparts. Subparts can only be added to draft part revisions. Requires the permission to create draft part revisions.

Examples

# request
curl -X POST -H 'Accept: application/xml' -H 'Content-Type: application/xml' -d "
<part_revision>
  <remove_existing>true</remove_existing>
  <subparts type='array'>
    <subpart>
      <subpart_id>728</subpart_id>
      <quantity>2</quantity>
      <build_sequence>1</build_sequence>
      <designator>A1, A2</designator>
      <no_load>true</no_load>
      <comment>Base of enclosure.</comment>
    </subpart>
    <subpart>
      <subpart_id>754</subpart_id>
      <subpart_part_revision_id>199</subpart_part_revision_id>
      <quantity>4</quantity>
      <build_sequence>2</build_sequence>
      <designator>B1</designator>
      <no_load>false</no_load>
      <comment>Lid for enclosure.</comment>
    </subpart>
  </subparts>
</part_revision>" \
https://demo.aligni.com/api/v2/oid3vLgynoy_Yl1gZkrgkLEq3J/parts/764/revisions/210/subparts

# success response
<?xml version="1.0" encoding="UTF-8"?>
<part_revision>
  <id>210</id>
  <revision_name>A</revision_name>
  <revision_description></revision_description>
  <creator_id>9</creator_id>
  <released_at>2016-01-28 20:11:47 -0800</released_at>
  <releasor_id>9</releasor_id>
  <comment>SM-0603, 1%, 1/10W</comment>
  <description>Thick-film resistor</description>
  <rohs>1</rohs>
  <status>Active</status>
  <x_package/>
  <x_packaging>Tape and Reel</x_packaging>
  <x_tolerance>1.0</x_tolerance>
  <x_mass value_text="6 m">0.006</x_mass>
  <x_schematic_symbol>Resistor</x_schematic_symbol>
  <x_serialized>false</x_serialized>
  <x_pcb_footprint_1>RESC1608N</x_pcb_footprint_1>
  <x_power value_text=""/>
  <x_pcb_footprint_2>Digikey website | http://www.digikey.com</x_pcb_footprint_2>
  <x_pcb_footprint_3/>
  <x_link/>
  <x_lifecycle_status/>
  <part>
    <id>764</id>
    <partnumber>000229</partnumber>
    <manufacturer_pn>CRCW060344K2FKEA</manufacturer_pn>
    <manufacturer_id>152</manufacturer_id>
    <parttype_id>48</parttype_id>
    <value>44200.0</value>
    <value_text>44.2 k</value_text>
    <created_on>2015-02-28 15:07:57 -0800</created_on>
    <updated_on>2017-08-05 16:58:34 -0700</updated_on>
    <inventory_price>0.0011</inventory_price>
    <estimated_cost>0.0011</estimated_cost>
    <estimated_cost_currency>USD</estimated_cost_currency>
    <reorder_quantity></reorder_quantity>
    <inventory_maximum></inventory_maximum>
    <preferred_vendor>Digi-Key</preferred_vendor>
  </part>
  <subparts>
    <subpart>
      <id>231</id>
      <part_id>728</part_id>
      <part_revision_id>171</part_revision_id>
      <quantity>2</quantity>
      <build_sequence>1</build_sequence>
      <comment>Base of enclosure.</comment>
      <designator>A1, A2</designator>
      <no_load>true</no_load>
      <position>1</position>
    </subpart>
    <subpart>
      <id>232</id>
      <part_id>754</part_id>
      <part_revision_id>199</part_revision_id>
      <quantity>4</quantity>
      <build_sequence>2</build_sequence>
      <comment>Lid for enclosure.</comment>
      <designator>B1</designator>
      <no_load>false</no_load>
      <position>2</position>
    </subpart>
  </subparts>
</part_revision>

# example error response #1
<?xml version="1.0"?>
<subparts type="array">
  <subpart>
    <number>1</number>
    <errors type="array">
      <error>Quantity must be nonnegative.</error>
    </errors>
  </subpart>
  <subpart>
    <number>2</number>
    <errors type="array">
      <error>You must specify a valid subpart.</error>
      <error>Must belong to a valid subpart part revision.</error>
    </errors>
  </subpart>
</subparts>

# example error response #2
<?xml version="1.0"?>
<errors type="array">
  <error>No subparts specified.</error>
</errors>

Params

Param name Description
api_token
required

Your API token.


Value: Must be a String
part_id
required

Part revision part ID.


Value: Must be a number.
id
required

Part revision ID.


Value: Must be a number.
remove_existing
optional

Remove existing subparts on the part revision.


Value: Must be one of: <code>true</code>, <code>false</code>.
subparts
optional

An array of subpart attributes.


Value: Must be an Array of nested elements
subparts[subpart]
required

Value: Must be a Hash
subparts[subpart][subpart_id]
required

ID of the part being added to the part revision as a subpart.


Value: Must be a number.
subparts[subpart][subpart_part_revision_id]
optional

ID of the part revision of the part being added to the part revision as a subpart. Defaults to the active revision if not specified.


Value: Must be a number.
subparts[subpart][quantity]
required

Quantity. Must be a non-negative number.


Value: Must be a number.
subparts[subpart][build_sequence]
optional

Build sequence.


Value: Must be a number.
subparts[subpart][designator]
optional

Designator(s).


Value: Must be a String
subparts[subpart][no_load]
optional

Don't include the subpart on cost sheet, short list, or computations.


Value: Must be one of: <code>true</code>, <code>false</code>.
subparts[subpart][comment]
optional

Comment.


Value: Must be a String