Welcome to the Behavioural Questions RESTful API Guide

Records will be returned in the following JSON format:

{ "_id": a unique ID Number, in BSON format allocated automatically.
,"question": a String which poses the question you want to ask.
,"values": An array of strings with leadership values [], }

n.b. _id is allocated automatically for new records

Accessing the API

Return a Number of Random Questions

Send a GET request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/random/:number

replacing :number in the URI with the number of random questions you'd like to get

Get a Question by ObjectId

Send a GET request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/:id

replacing :id in the URI with the ObjectId of your target question
Object Ids are in the standard BSON format, you can find them specifically from other searches.

Get a Question by a Single Value

Send a GET request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/value/:value

replacing :value in the URI with your target leadership value in string format
Object Ids are in the standard BSON format.

Submit a New Question

Send a POST request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/addone

Omit the ObjectId in the JSON as these will be allocated automatically,
Include the new question in JSON format correctly in the format displayed below.
{"question": "a String which poses the question you want to ask."
,"values": ["An array", "of strings with", "leadership values" ]}

Submit many New Questions

Send a POST request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/addmany

Omit the ObjectId in the JSON as these will be allocated automatically,
Include the new question in JSON format correctly in a different format to the one above, specifically like this:


                { "array" :[{
                    "question":
                        "{Insert Question Text Here}",
                    "values": [value1, value2, value3]
                },
                {
                    "question":
                        "{Insert Question Text 2 Here}",
                    "values": [value1, value2, value3]
                }]}
            

Replace a Question

Send a POST request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/:id/replace

replacing :id in the URI with the ObjectId of your target question
submit your replacement question in JSON format as the body of the POST request in the following format:
{"question": "a String which poses the question you want to ask."
,"values": ["An array", "of strings with", "leadership values" ]}

Replace the values of a Question

Send a POST request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/:id/values/replace

replacing :id in the URI with the ObjectId of your target question
submit your replacement values in JSON format, but as a series of strings within an array. as the body of the POST request
{ "values": ["optimistic", "results oriented", "sense of humour", "speed", "versatility"] }

Add a value to the values array of a Question

Send a PATCH request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/:id/:value/addvalue

replacing :id in the URI with the ObjectId of your target question
and {value} in the URI with the name of the value you want to add
no body is needed as the request can be handled solely by parameters

Delete a question by ObjectId

Send a DELETE request to:
https://behavioural-recruitment-api.azurewebsites.net/api/questions/:id/delete

replacing :id in the URI with the ObjectId of your target question
The api will target that question, delete it and either confirm or show an error { "values": ["optimistic", "results oriented", "sense of humour", "speed", "versatility"] }