put https://secure.fusebill.com/v1/SubscriptionProductItems
This function will allow you to edit a Subscription Product Item in a specific Subscription Product in a specific Subscription for a Customer.
Request Parameters
Property | Type | Description |
---|---|---|
reference | String | This is the unique code which represents this Item. This would be, for example, where you would store the Serial Key for a software product a customer had purchased.[Max Length 255 characters] |
id | Integer | This is the unique ID of the Subscription Product which this Item belongs to. This defines which Subscription Product, and by extension which subscription and therefor which customer, this item is added to. |
name | String | This is the name of the item. [Max Length 100 characters] |
description | String | This is the description of the item.[Max Length 255 characters] |
Examples
curl -X PUT "https://secure.fusebill.com/v1/SubscriptionProductItems" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{id:{subscriptionProductId},reference:'00101002',name:'Included Mobile Device',description:'A new mobile device tracked by serial number.'}"
//Json Payload
string jsonData = "{id:{subscriptionProductId},reference:'Item 1 Reference',name:'Included Mobile Device',description:'A new mobile device tracked by serial number.'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionProductItems/");
//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 dictionary to the Payload parameter
payload = {"reference":"This is a reference","name":"New name","description":None,"subscriptionProductId":{id},"status":"Active","createdDate":None,"id":{id},"uri":None}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/subscriptionProductItems', data=json.dumps(payload), headers=headers)
print(r.content)
{
"reference": 123459651622156,
"name": "Thermostat",
"description": "MODEL MC1-0092",
"subscriptionProductId": 2334138,
"subscriptionId": 305425,
"customerId": 643539,
"productId": 46818,
"status": "Active",
"createdDate": "2019-11-01T11:51:26",
"modifiedDate": "2019-11-01T11:51:26.77",
"id": 242386,
"uri": "https://secure.fusebill.com/v1/subscriptionProductItems/242386"
}
Response
{
"reference": 123459651622156,
"name": "Thermostat",
"description": "MODEL MC1-0092",
"subscriptionProductId": 2334138,
"subscriptionId": 305425,
"customerId": 643539,
"productId": 46818,
"status": "Active",
"createdDate": "2019-11-01T11:51:26",
"modifiedDate": "2019-11-01T11:51:26.77",
"id": 242386,
"uri": "https://secure.fusebill.com/v1/subscriptionProductItems/242386"
}
{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Cannot edit a deleted subscription product item"
}
]
}