CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_easy_setopt(curl, CURLOPT_URL, "https://api.swep.net/graphql"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); struct curl_slist *headers = NULL; headers = curl_slist_append(headers, "x-api-key: YOUR_API_KEY"); headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); const char *data = "{\r\n \"query\": \"query Calculate() {\\r\\n calculateSinglePhase(request: {\\r\\n inputs: {\\r\\n calculationMethod: DESIGN,\\r\\n selectedFluidSide1: {\\r\\n fluidId: 53,\\r\\n isGas: false,\\r\\n inputValue: null\\r\\n },\\r\\n selectedFluidSide2: {\\r\\n fluidId: 53,\\r\\n isGas: false,\\r\\n inputValue: null\\r\\n },\\r\\n coCurrent: false,\\r\\n selectedHeatExchangers: [\\r\\n {\\r\\n heatExchangerInputType: PARENT,\\r\\n id: 1\\r\\n }\\r\\n ],\\r\\n heatLoad: {\\r\\n amount: 50,\\r\\n unit: KILOWATT\\r\\n },\\r\\n inletTemperatureSide1: {\\r\\n amount: 80,\\r\\n unit: DEGREE_CELSIUS\\r\\n },\\r\\n inletTemperatureSide2: {\\r\\n amount: 20,\\r\\n unit: DEGREE_CELSIUS\\r\\n },\\r\\n outletTemperatureSide1: {\\r\\n amount: 40,\\r\\n unit: DEGREE_CELSIUS\\r\\n },\\r\\n outletTemperatureSide2: {\\r\\n amount: 50,\\r\\n unit: DEGREE_CELSIUS\\r\\n },\\r\\n flowSide1: null,\\r\\n flowSide2: null,\\r\\n maxPressureDropSide1: {\\r\\n amount: 20000,\\r\\n unit: PASCAL\\r\\n },\\r\\n maxPressureDropSide2: {\\r\\n amount: 20000,\\r\\n unit: PASCAL\\r\\n },\\r\\n numberOfPasses: null,\\r\\n numberOfPlates: null,\\r\\n numberOfPlatesStack1: null,\\r\\n numberOfPlatesStack2: null,\\r\\n oversurface: null,\\r\\n portSwitch: true,\\r\\n autoperformance: false\\r\\n }\\r\\n }) {\\r\\n res : calculationResult {\\r\\n hesNewName : calculatedHeatExchangers {\\r\\n he :calculatedHeatExchanger {\\r\\n modelName,\\r\\n xpc {\\r\\n class, type, size, material, subtype, execution, pressure\\r\\n }\\r\\n },\\r\\n out:calculationOutputValues {\\r\\n pressureDropSide2 {\\r\\n amount\\r\\n },\\r\\n pressureDropSide1 {\\r\\n amount\\r\\n },\\r\\n overSurface {\\r\\n amount\\r\\n },\\r\\n portDiameter1 {\\r\\n amount\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n}\\r\\n}\"\r\n}"; curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data); res = curl_easy_perform(curl); curl_slist_free_all(headers); } curl_easy_cleanup(curl);