Authorization: Basic [Base64EncodedUserNameAndPassword]
HttpClient httpclient = new HttpClient();
httpClient.baseAddress = httpclient.BaseAddress = new Uri("https://requestbox.net//api/[UrlParameter]/");
string base64 = Convert.ToBase64String(Encoding.UTF8.GetBytes("ApiKey:[MyApiKeyValue]"));
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64);
User drop down fields: Will try to match on the email or full name of the user
Datastore drop downs: Will need to pass the DatastoreColumnName property. Will attempt to match on the chosen column
Field maps can be created in requestbox to create custom mapping rules. You pass this via the FieldMap property. If no direct match is found from the incoming value it will then attempt to match based on the field map.
Custom item and datastore drop downs are currently supported. You can map zero, one or many values to each item.
public class CreateRequestInput
{
public int RequestTypeId { get; set; }
public List<CustomFieldData> CustomFieldData { get; set; } = new List<CustomFieldData>();
}
public class CustomFieldData
{
public string FieldName { get; set; }
public string Value { get; set; }
}
public void CreateRequest(){
CreateRequestInput input = new CreateRequestInput();
input.RequestTypeId = 500;
input.CustomFieldData.Add(new CustomFieldData {
FieldName = "RequestName",
Value = "MyReqName"
});
string jsonPostContent = JsonConvert.SerializeObject(input);
StringContent bodyContent = new StringContent(jsonPostContent, Encoding.UTF8, "application/json");
var response = _client.PostAsync("create-request", bodyContent).Result;
}
{
"status":"success",
"message":"Request was created successfully",
"warnings": [],
"request":
{
"id":1000,
"requestTypeId":500,
"requestTypeName":"MyRequestType",
"boxName":"MyBoxName",
"status":"Submitted",
"createdDate":"2022-04-14T00:00:00.0000000Z",
"updatedDate":"2022-04-14T00:00:00.0000000Z"
}
}
public void GetRequest(){
var response = _client.GetAsync("get-request?requestId=1000").Result;
}
{
"status":"success",
"message":"Request was retrieved successfully",
"request":
{
"id":1000,
"requestTypeId":500,
"requestTypeName":"MyRequestType",
"boxName":"MyBoxName",
"status":"Submitted",
"createdDate":"2022-04-14T00:00:00.0000000Z",
"updatedDate":"2022-04-14T00:00:00.0000000Z"
}
}
public class SearchRequestInput {
public List<int> RequestTypeIdList {get; set;} = new List<int>();
}
public void SearchRequests(){
SearchRequestInput input = new SearchRequestInput();
input.RequestTypeIdList.Add(500);
string jsonPostContent = JsonConvert.SerializeObject(input);
StringContent bodyContent = new StringContent(jsonPostContent, Encoding.UTF8, "application/json");
var response = _client.PostAsync("search-requests",bodyContent).Result;
}
{
"status":"success",
"message":"Search requests completed successfully",
"totalRequests": 2,
"requests":
[
{
"id":1000,
"requestTypeId":500,
"requestTypeName":"MyRequestType",
"boxName":"MyBoxName",
"status":"Submitted",
"createdDate":"2022-04-14T00:00:00.0000000Z",
"updatedDate":"2022-04-14T00:00:00.0000000Z"
},
{
"id":1001,
"requestTypeId":500,
"requestTypeName":"MyRequestType",
"boxName":"MyBoxName",
"status":"Submitted",
"createdDate":"2022-04-14T00:00:00.0000000Z",
"updatedDate":"2022-04-14T00:00:00.0000000Z"
}
]
}