put https://secure.fusebill.com/v1/SubscriptionProductCustomFields
This call allows you to edit the value of a Custom Field on a SubscriptionProduct inside a Subscription.
Request Parameters
Property | Type | Description |
---|---|---|
key | String | This is the unique key of the Custom Field you wish to modify. |
subscriptionProductId | Integer | This is the Id of the subscription product in which the custom field exists. |
Value | String | This is the value you wish to update the custom field to. This will always be the string version of the value. If you wish to pass a number, for example, pass it as "123". Likewise, a DateTime would be passed as "2014-06-26T04:00:00". We will use the known data type of the custom field to properly convert the String to a Number, DateTime, etc. |
Examples
curl -X PUT "https://secure.fusebill.com/v1/SubscriptionProductCustomFields" \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{key:'PolicyNumber',subscriptionProductId:{subscriptionProductId},Value:'123456'}"
//Json Payload
string jsonData = "{key:'YourCustomFieldKey',subscriptionProductId:{subscriptionProductId},Value:'Custom Field Value'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/SubscriptionProductCustomFields/");
//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 = {'key':'somecustomfield','subscriptionProductId':{id},'Value':'default value'}
#Pass in your URI, Payload and Headers
r = requests.put('https://secure.fusebill.com/v1/subscriptionProductCustomFields', data=json.dumps(payload), headers=headers)
print(r.content)
{
"subscriptionProductId": 1234865,
"key": "PolicyNumber",
"Value": "AB12388Sen"
}
Response
{
"key":"PolicyNumber",
"friendlyName":"Policy Number",
"dataType":"String",
"value":"123456"
}
{
"ErrorId": 0,
"HttpStatusCode": 404,
"Errors": [
{
"Key": "Api Error",
"Value": "Custom Field with key Prolicy Number not found."
}
]
}