# Create Work Order from Existing POST https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting Content-Type: application/json Creates a kitting work order based on an existing shipment, including steps, line items, fulfillment center, and product details. Reference: https://developer-stage.shipbob.dev/experimental/api/kitting/create-work-order-from-existing ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: api-experimental version: 1.0.0 paths: /Experimental/kitting:createFromExisting: post: operationId: create-work-order-from-existing summary: | Create Work Order from Existing description: > Creates a kitting work order based on an existing shipment, including steps, line items, fulfillment center, and product details. tags: - subpackage_kitting parameters: - name: Authorization in: header description: Authentication using Personal Access Token (PAT) token required: true schema: type: string responses: '201': description: Success content: application/json: schema: $ref: '#/components/schemas/Kitting.PublicWorkOrderShipmentIdResponse' '500': description: Server Error content: application/json: schema: $ref: '#/components/schemas/Kitting.ApiError' requestBody: description: Request containing the details for creating the work order content: application/json: schema: $ref: '#/components/schemas/Kitting.PublicKittingWorkOrderCopyRequest' servers: - url: https://sandbox-api.shipbob.com components: schemas: Kitting.PublicWorkOrderLineItemRequest: type: object properties: inventory_id: type: integer description: >- Inventory identifier to be included as a line item in the work order. quantity: type: integer description: >- Quantity to be used for the inventory in the line item for the work order. title: Kitting.PublicWorkOrderLineItemRequest Kitting.PublicKittingWorkOrderCopyRequest: type: object properties: end_kitted_inventory_id: type: integer description: >- Inventory identifier of the kitted product to be used in the work order. fulfillment_center_id: type: integer description: The fulfillment center id associated with the work order. line_items: type: - array - 'null' items: $ref: '#/components/schemas/Kitting.PublicWorkOrderLineItemRequest' description: >- Line items to be included in the work order. These line items will be used instead of the line items from the source shipment when creating the work order. If not provided, line items from the source shipment will be used by default. lot_date: type: - string - 'null' format: date-time description: Lot expiration date to be associated with the work order. lot_number: type: - string - 'null' description: Lot number to be associated with the work order. shipment_id: type: integer description: >- Id of the shipment to copy line items and details from when creating the kitting work order. required: - end_kitted_inventory_id - fulfillment_center_id - shipment_id title: Kitting.PublicKittingWorkOrderCopyRequest Kitting.PublicWorkOrderShipmentIdResponse: type: object properties: shipment_id: type: integer description: Id of the created shipment title: Kitting.PublicWorkOrderShipmentIdResponse Kitting.ApiError: type: object properties: details: oneOf: - description: Any type - type: 'null' errors: type: array items: type: string message: type: string stackTrace: type: - string - 'null' title: Kitting.ApiError securitySchemes: PAT: type: http scheme: bearer description: Authentication using Personal Access Token (PAT) token OAuth2: type: http scheme: bearer description: OAuth2 authentication using JWT tokens ``` ## SDK Code Examples ```python Kitting_createWorkOrderFromExisting_example import requests url = "https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting" payload = { "end_kitted_inventory_id": 42, "fulfillment_center_id": 1, "shipment_id": 5001, "line_items": [ { "inventory_id": 101, "quantity": 10 }, { "inventory_id": 102, "quantity": 5 } ], "lot_date": "2024-01-15T09:00:00Z", "lot_number": "LOT-2024-001" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript Kitting_createWorkOrderFromExisting_example const url = 'https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"end_kitted_inventory_id":42,"fulfillment_center_id":1,"shipment_id":5001,"line_items":[{"inventory_id":101,"quantity":10},{"inventory_id":102,"quantity":5}],"lot_date":"2024-01-15T09:00:00Z","lot_number":"LOT-2024-001"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Kitting_createWorkOrderFromExisting_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting" payload := strings.NewReader("{\n \"end_kitted_inventory_id\": 42,\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"line_items\": [\n {\n \"inventory_id\": 101,\n \"quantity\": 10\n },\n {\n \"inventory_id\": 102,\n \"quantity\": 5\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00Z\",\n \"lot_number\": \"LOT-2024-001\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Kitting_createWorkOrderFromExisting_example require 'uri' require 'net/http' url = URI("https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"end_kitted_inventory_id\": 42,\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"line_items\": [\n {\n \"inventory_id\": 101,\n \"quantity\": 10\n },\n {\n \"inventory_id\": 102,\n \"quantity\": 5\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00Z\",\n \"lot_number\": \"LOT-2024-001\"\n}" response = http.request(request) puts response.read_body ``` ```java Kitting_createWorkOrderFromExisting_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"end_kitted_inventory_id\": 42,\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"line_items\": [\n {\n \"inventory_id\": 101,\n \"quantity\": 10\n },\n {\n \"inventory_id\": 102,\n \"quantity\": 5\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00Z\",\n \"lot_number\": \"LOT-2024-001\"\n}") .asString(); ``` ```php Kitting_createWorkOrderFromExisting_example request('POST', 'https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting', [ 'body' => '{ "end_kitted_inventory_id": 42, "fulfillment_center_id": 1, "shipment_id": 5001, "line_items": [ { "inventory_id": 101, "quantity": 10 }, { "inventory_id": 102, "quantity": 5 } ], "lot_date": "2024-01-15T09:00:00Z", "lot_number": "LOT-2024-001" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Kitting_createWorkOrderFromExisting_example using RestSharp; var client = new RestClient("https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"end_kitted_inventory_id\": 42,\n \"fulfillment_center_id\": 1,\n \"shipment_id\": 5001,\n \"line_items\": [\n {\n \"inventory_id\": 101,\n \"quantity\": 10\n },\n {\n \"inventory_id\": 102,\n \"quantity\": 5\n }\n ],\n \"lot_date\": \"2024-01-15T09:00:00Z\",\n \"lot_number\": \"LOT-2024-001\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Kitting_createWorkOrderFromExisting_example import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "end_kitted_inventory_id": 42, "fulfillment_center_id": 1, "shipment_id": 5001, "line_items": [ [ "inventory_id": 101, "quantity": 10 ], [ "inventory_id": 102, "quantity": 5 ] ], "lot_date": "2024-01-15T09:00:00Z", "lot_number": "LOT-2024-001" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://sandbox-api.shipbob.com/Experimental/kitting:createFromExisting")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```