post
https://secure.fusebill.com/v1/salesTrackingCodes
This method allows the creation of an additional Sales Tracking Code belonging to the selected type.
Parameter List
| Property | Type | Description | Required |
|---|---|---|---|
type | String | The category name this code falls under. Fusebill supports 5 distinct categories. By default the names are "Sales Tracking Code 1", "Sales Tracking Code 2",..."Sales Tracking Code 5" but they can be customized. If you rename your Sales Tracking code, those names or the default names can be used. | Yes |
code | String | The code from the category pick-list. **er List" [block:** | Yes |
name | String | The name associated with the code **ameter List" [bl** | Yes |
description | String | A description of the pick-list value **ter List" [block:** | Optional |
email | String | An email associated with the sales tracking code. **/block] [block:parameters] | Optional |
Examples
curl –X POST https://secure.fusebill.com/v1/salesTrackingCodes \
-H "Content-Type: application/json" \
-H "Authorization: Basic {APIKey}" \
-d "{type:'Sales Agent',code:'Smith',name:'Agent Smith'}"//Json data
string jsonData = "{'type':'Sales Agent','code':'Smith','name':'Agent Smith'}";
//Setup API key
string apiKey = "{APIKey}";
//Configure URI
WebRequest request = WebRequest.Create("HTTPS://secure.fusebill.com/v1/salesTrackingCodes");
//Add Content type
request.ContentType = "application/json";
//Add Api key authorization
request.Headers.Add(HttpRequestHeader.Authorization, "Basic "+apiKey);
//Set request method
request.Method = "POST";
//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 ={'type':'Sales Agent','code':'Smith','name':'Agent Smith'}
#Pass in your URI, Payload and Headers
r = requests.post('https://secure.fusebill.com/v1/SalesTrackingCodes', data=json.dumps(payload), headers=headers)
print(r.content){
"type":"Sales Tracking Code 1",
"code":"Foxtrot",
"name":"Sample name",
"description":"some descriptive text",
"email":"[email protected]"
}Response
{
"type": "Sales Tracking Code 2",
"code": "123",
"name": "Bob Smith",
"description": "sample string sample sting",
"email": "[email protected]",
"status": "Active",
"deletable": true,
"id": 35397,
"uri": "https://secure.fusebill.com/v1/salesTrackingCodes/35397"
}{
"ErrorId": 0,
"HttpStatusCode": 400,
"Errors": [
{
"Key": "Api Error",
"Value": "Unknown sales tracking code type Sales Tracking Code 6. Valid types are: Sales Tracking Code 1, Sales Tracking Code 2, Sales Tracking Code 3, Sales Tracking Code 4, Sales Tracking Code 5"
}
]
} 200