# Update item PUT https://api-sandbox.payabli.com/api/LineItem/{lineItemId} Content-Type: application/json Updates an item. Reference: https://docs.payabli.com/developers/api-reference/lineitem/update-item-in-entrypoint ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Update item in entrypoint version: endpoint_lineItem.UpdateItem paths: /LineItem/{lineItemId}: put: operationId: update-item summary: Update item in entrypoint description: Updates an item. tags: - - subpackage_lineItem parameters: - name: lineItemId in: path description: ID for the line item (also known as a product, service, or item). required: true schema: type: integer - name: requestToken in: header required: true schema: type: string responses: '200': description: Success content: application/json: schema: $ref: '#/components/schemas/type_:PayabliApiResponse6' requestBody: content: application/json: schema: $ref: '#/components/schemas/type_:LineItem' components: schemas: type_:ItemCommodityCode: type: string type_:ItemDescription: type: string type_:ItemProductCode: type: string type_:ItemProductName: type: string type_:ItemUnitofMeasure: type: string type_:LineItem: type: object properties: itemCategories: type: array items: type: string description: Array of tags classifying item or product. itemCommodityCode: $ref: '#/components/schemas/type_:ItemCommodityCode' itemCost: type: number format: double description: Item or product price per unit. itemDescription: $ref: '#/components/schemas/type_:ItemDescription' itemMode: type: integer description: >- Internal class of item or product: value '0' is only for invoices, '1' for bills, and '2' is common for both. itemProductCode: $ref: '#/components/schemas/type_:ItemProductCode' itemProductName: $ref: '#/components/schemas/type_:ItemProductName' itemQty: type: integer description: Quantity of item or product. itemUnitOfMeasure: $ref: '#/components/schemas/type_:ItemUnitofMeasure' required: - itemCost - itemQty type_:IsSuccess: type: boolean type_:PageIdentifier: type: string type_:Responsedatanonobject: oneOf: - type: string - type: integer type_:ResponseText: type: string type_:PayabliApiResponse6: type: object properties: isSuccess: $ref: '#/components/schemas/type_:IsSuccess' pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' responseData: $ref: '#/components/schemas/type_:Responsedatanonobject' description: >- If `isSuccess` = true, this contains the line item identifier. If `isSuccess` = false, this contains the reason of the error. responseText: $ref: '#/components/schemas/type_:ResponseText' required: - responseText ``` ## SDK Code Examples ```python UpdateItem from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.line_item.update_item( line_item_id=700, item_cost=12.45, item_qty=1, ) ``` ```typescript UpdateItem import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.lineItem.updateItem(700, { itemCost: 12.45, itemQty: 1 }); ``` ```go UpdateItem import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.LineItem.UpdateItem( context.TODO(), 700, &sdkgo.LineItem{ ItemCost: 12.45, ItemQty: 1, }, ) ``` ```csharp UpdateItem using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.LineItem.UpdateItemAsync(700, new LineItem { ItemCost = 12.45, ItemQty = 1 }); ``` ```ruby UpdateItem require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/LineItem/700") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"itemCost\": 12.45,\n \"itemQty\": 1\n}" response = http.request(request) puts response.read_body ``` ```java UpdateItem HttpResponse response = Unirest.put("https://api-sandbox.payabli.com/api/LineItem/700") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"itemCost\": 12.45,\n \"itemQty\": 1\n}") .asString(); ``` ```php UpdateItem request('PUT', 'https://api-sandbox.payabli.com/api/LineItem/700', [ 'body' => '{ "itemCost": 12.45, "itemQty": 1 }', 'headers' => [ 'Content-Type' => 'application/json', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift UpdateItem import Foundation let headers = [ "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "itemCost": 12.45, "itemQty": 1 ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/LineItem/700")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PUT" 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() ```