menu button

API process flow

Init Protocol

  • After the upload, the mutation named initProtocol imports audio into the system for further processing.

  • With this mutation, the document element is created in the backend. The uniqueObjName parameter from the getUploadUrl query is crucial here. It’s required to save the results for the corresponding element.

Input Parameters

  • date (Date!)
    The date associated with the audio file, typically representing when it was recorded.

  • name (String!)
    The name or title of the audio file.

  • language (String!)
    The language code of the audio content. Supported options include:

    • 'de-DE' (German - Germany)
    • 'de-CH' (German - Switzerland)
    • 'de-AT' (German - Austria)
    • 'en-EN' (English)
  • uniqueObjName (String!)
    The object name used to locate the audio file, often corresponding to the S3 key or filename. this key needs to be unique, you can use our recommended random number generator to create this object, it should be 30 characters

      function generateRandomId(length) {
        let id = "";
        const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        const charsetLength = charset.length;
    
        for (let i = 0; i < length; i++) {
          const randomIndex = Math.floor(Math.random() * charsetLength);
          id += charset.charAt(randomIndex);
        }
    
        return id;
      }
  • projectSlug (String!)

    The slug of the project, the projectSlug can be fetch using getAllProjects or you can create a new project using createProject mutation.

  • typeOfDocument (String!)
    The type of document to generate from the audio. Supported types include:

    • summary
    • politics
  • speakerList ([PersonInputList])

    • [{
        "gender":"m", 
        "givenName":"Thomas",
        "familyName":"Müller",
        "party":"",
        "preTitle":"",
        "postTitle":"",
        "systemId":""
      }, ...]
  • agendaItemList ([AgendaItemListInput])

    • The structure must conform to the AgendaItemListType definition.
    • The systemId field within each object is used during the export process back to the parent system.
    • The startTime is an optional parameter. If this one is set the agenda item is set on the exact timestamp or just before the sentence if the time is within a sentence.
    • The title is the name of the agenda item.
    • "agendaItemList": [
        {
          "title":"TOP 1",
          "systemId":"1",
          "startTime":""
        },{
          "title":"Agenda Point 2",
          "systemId":"2",
          "startTime":""
        }
      ]

Ensure all fields are correctly formatted and valid before calling the mutation.

Example GraphQL Mutation (initProtocol):

    const INIT_PROTOCOL = `
      fragment protocolDetails on ApiProtocolType {
      slug
      name
      status
      date
      language
      empty
      creatingStep
      status
      renamedSpeakers
    }

    mutation InitProtocol(
      $date: Date!
      $name: String!
      $agendaItemList: [AgendaItemListInput]
      $speakerList: [PersonInputList]
      $projectSlug: String!
      $language: String!
      $uniqueObjName: String!
      $typeOfDocument: String!
      ){
        initProtocol(
          name: $name
          date: $date,
          language: $language,
          typeOfDocument: $typeOfDocument
          agendaItemList: $agendaItemList
          speakerList: $speakerList
          uniqueObjName: $uniqueObjName
          projectSlug: $projectSlug
          ){
          success
          protocol{
            ...protocolDetails
          }
        }
      }
    `;

Example Data Object for INIT_PROTOCOL Mutation

  {
    query: INIT_PROTOCOL,
    variables: {
      "agendaItemList": [
        {
          "title":"TOP 1",
          "systemId":"1",
          "startTime":"",
          "resolution":""
        },{
          "title":"Agenda Point 2",
          "systemId":"2",
          "startTime":"",
          "resolution":""
        }
      ], 
      "date":"2025-11-20", 
      "language":"de-DE",
      "name":"Testprotokoll",
      "projectSlug":"PROJECT_SLUG",
      "speakerList":[{
        "gender":"m", 
        "givenName":"Thomas",
        "familyName":"Müller",
        "party":"",
        "preTitle":"",
        "postTitle":"",
        "systemId":""
      },{
        "gender":"w", 
        "givenName":"Maxi",
        "familyName":"Musterfrau",
        "party":"",
        "preTitle":"",
        "postTitle":"",
        "systemId":""
      }],
      "typeOfDocument":"politics",
      "uniqueObjName":"UNIQUE_OBJ_NAME"
      },
  };

Example JS code

    import axios from "axios";
    async function createAudioBackend(audioItem, uniqueObjName) {

      let dataObj = {
        query: INIT_PROTOCOL,
        variables: {
          date: audioItem.date,
          name: audioItem.name, // max 200 chars
          agendaItemList: audioItem.agendaItemList,
          speakerList: audioItem.speakerList,
          projectSlug: audioItem.projectSlug,
          language: audioItem.language,
          uniqueObjName: uniqueObjName,
          typeOfDocument: audioItem.typeOfDocument // 'summary' or 'politics'
        },
      };

      await axios({
        method: "post",
        url: process.env.VUE_APP_GRAPHQL_API,
        data: JSON.stringify(dataObj),
        headers: {
          "Content-Type": "application/json",
          "x-api-key": process.env.VUE_APP_API_KEY,
        },
      })
        .then(() => {
          console.log("Audio created successfully");
        })
        .catch((error) => {   
          console.log(error);
        })
        .finally(() => {
          console.log("Upload completed");
        });
    }

Each step builds upon the previous one:

  • The URL from getUploadUrl is utilized for uploading the file to S3,
  • And the result is then passed to the initProtocol mutation to complete the process.

Have questions?

Still have questions? Talk to support.