put https://secure.fusebill.com/v1/purchaseProductItems
This call edits a tracked item on a draft purchase. For this call it does not matter whether the purchase is in draft status, purchased status, or cancelled status
Property | Type | Description | Required |
---|---|---|---|
reference | String | The unique identifier for this tracked item. This uniqueness is enforced by Fusebill across all tracked items for that product, not just tracked items on the given purchase. [Max Length: 255 characters] | Yes |
id | Integer | The Fusebill generated unique ID for the tracked item on a purchase | Yes |
name | String | An field for storing custom data, intended to be the name of the item. [Max Length 100 characters] | Yes |
description | String | An optional field for storing custom data, intended to be a description of the item. [Max Length: 255 characters] | Optional |
Examples
curl –X PUT https://secure.fusebill.com/v1/purchaseProductItems\
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{reference:'vh63k2jxu77291z',name:'license code',description: 'Premium Edition',id:242382}"
//Json data for payload
string jsonData = "{'reference':'vh63k2jxu77291z','name':'license code', 'description': 'Premium Edition','id':242382}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/purchaseProductItems");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "PUT";
//Add the json data to request
using (var streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(jsonData);
streamWriter.Flush();
streamWriter.Close();
}
//Perform the request:
var httpResponse = (HttpWebResponse)request.GetResponse();
//Record the response from our request
var result = "";
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
result = streamReader.ReadToEnd();
}
#Import library JSON
import json
#Import library Requests
import requests
#Pass in a dictionary to the Headers parameter
headers = {'Authorization' : 'Basic {APIKey}', 'Content-Type' : 'application/json'}
#Pass in a dict to the Payload parameter
payload = {'reference':'vh63k2jxu77291z','name':'license code', 'description': 'Premium Edition','id':242382}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/purchaseProductItems', data=json.dumps(payload), headers=headers)
print(r.content)
{
"reference": "vh63k2jxu77291",
"name": "Liscence Code",
"description": "Premium Edition",
"purchaseId": 165111,
"customerId": 650594,
"productId": 46818,
"status": "Active",
"createdDate": "2019-11-08T13:50:32",
"modifiedDate": "2019-11-08T13:50:32.64",
"id": 242593,
"uri": "https://secure.fusebill.com/v1/purchaseProductItems/242593"
}
Response
{
"reference": "vh63k2jxu77291",
"name": "Liscence Code",
"description": "Premium Edition",
"purchaseId": 165111,
"customerId": 650594,
"productId": 46818,
"status": "Active",
"createdDate": "2019-11-08T13:50:32",
"modifiedDate": "2019-11-08T13:50:32.64",
"id": 242593,
"uri": "https://secure.fusebill.com/v1/purchaseProductItems/242593"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Cannot edit a deleted purchase product item"
}
]
}