Update of a Questionnaire Using the Supplier Data API

You can update questionnaire data, including metadata, Q&A data, and attachments.

For a likely use case, suppose a business changes locations and you wish to update the address provided for that business in a particular questionnaire. You could use the /queryQuestionnaireDetails endpoint to view the current responses; searching the JSON response for the old address, you can find the appropriate question and its associated itemId. Then you could use the /submitQuestionnaireResponse endpoint to update the desired responses by passing the itemId and the new address in the request body.

The following questionnaire types are supported:
  • Registration questionnaire

  • Qualification questionnaire

  • Modular questionaire

Limitations

When you update the answer to a questionnaire question, you must format the new answer correctly. For example, date-time questions must use the date-time format the questionnaire expects. If the original answer used MM-DD-YYYY format, the new answer must use that format as well.
External questionnaires in the following states are not supported:
  • Not Responded

  • Pending Submission

  • Pending Resubmission

In general, if a task is open on the supplier side for an external questionnaire, this API cannot be applied.

How to Update a Questionnaire Using the Supplier Data API

  1. To receive full questionnaire details, use the /queryQuestionnaireDetails endpoint to pass the vendor ID of the desired supplier and an optional questionnaire ID for the desired questionnaire. If you pass a questionnaire ID and a vendor ID, you limit the response to a single questionnaire; if you pass only the vendor ID, the response includes details of all questionnaires for the specified vendor.

    {{runtime_url}}/queryQuestionnaireDetails
    {
    	"smVendorId":"Vend123",
    	"questionnaireId":"Doc1234a"
    }
    smVendorId
    The supplier's vendor ID
    questionnaireId
    The document ID for the desired questionnaire. You can find this ID in the JSON response in the documentId field.
  2. Each question within a questionnaire has a unique itemId that distinguishes it from other questions within the questionnaire. Locate the desired questionnaire in the JSON response and find the itemId for each question you wish to update.

  3. Use the /submitQuestionnaireResponse endpoint to update the questionnaire. Pass the documentId of the questionnaire in the request URL as follows:

    POST {{request_url}}/submitQuestionnaireResponse?questionnaireId=Doc1234a
    questionnaireId
    The document ID for the desired questionnaire. Use the same value you used in step 1.

    The request body dictates what updates will be made, as follows:

    • To update the answer to a question, pass the question's itemId and new answer in the answers block:

      {"answers":[
      	{
      	"itemId": "itemId_Q1",
      	"answer": "new answer for the first question"
      	},
      	{
      	"itemId": "itemId_Q2",
      	"answer": "new answer for next question"
      	}
      ]}
    • To attach an attachment to the questionnaire, pass its 64-bit-encoded value in the fileContents field in the answers block:

      {"answers":[
      	{		
      	"itemId": "itemId_attachmentQ",
      	"attachment": {
      		"fileName": "SampleFileName.csv",
      		"mimeType": "application/csv",
      		"fileSize": 221725,
      		"fileContents": "64 Bit encoded value"
      		}
      	}
      ]}
    answers
    Include your updates in this block in the request body JSON.
    itemId
    The ID of the desired question. Item IDs are set at the template level, so they are unique within a particular questionnaire; however question 1 will have the same itemId in every questionnaire derived from a particular template.
    answer
    The new answer you wish to post for the specified question. You must provide the new answer in the correct format. For example, if the question expects a date in MM-DD-YYYYTHH:MM:SSZ format, you must provide the new date in that format. Similarly, if a text answer has a maximum number of characters, the new answer must conform to that maximum.
    fileContents
    Provide the 64-bit-encoded value for the desired attachment in this field.