Why is HTTP request failing?

Hello,
I’m sending a POST request to an API (Salad Transcription) and on testing the flow it seems to be returning OK, but that HTTP post piece is failing in the run so I can’t ‘grab’ a variable from the returned response to insert into the next step of the flow. See screen recording with my audio explaining here: Screen Recording 2024-11-20...

Can you help with why it’s failing and how can I resolve it?

Thank you,
Bharat

The transcription service returned a response with status code 401 Unauthorized:

image

I suspect there’s a mistake in the way authentication is configured for your POST request.

Side-note: your API key is exposed in the recording, make sure you invalidate it and get a new one.

@HoldYourWaffle that’s what I thought so I made some updates and now I receive a 400 error as here states ‘The input was not valid’

However, I believe I’m formatting the response correctly.

The CURL example in the Salad docs here have 2 headers which I’m placing individually in the Headers section of the Piece.

Even though Query Params in the Piece is a required field, I’m not adding any parameters as there don’t seem to be any to add.

The body is set as JSON with a customised version of the -d JSON from the curl example, and is placed in the Body.

See here for how the Piece is configured.

So still I can’t see why the Piece is failing.

Any suggestions would be sincerely appreciated.

Re: API key, I had changed it after the video and I thought I’d put in a dummy one in the video but noticed that the vid had the full key in one section. Thanks for that anyway.

Bharat

It’s difficult to read the weirdly formatted output, but I suspect there’s a missing a comma between custom_vocabulary and webhook:

If that’s not the problem, can you post the full JSON request body here?

@HoldYourWaffle the comma was missing, thank you. So I’ve added it, checked everything again and the response is now a 500 error.

This is the config of the Piece (I’ve hard coded the URL of a test audio file and the API key has now been changed)

This is the input and output from the test run details.

For clarity this the JSON in the config of the Piece:

{
  "input": {
    "srt": true,
    "url": "https://karavadra.net/shared/thequick.mp3",
    "summarize": 0,
    "translate": "to_eng",
    "diarization": true,
    "language_code": "en",
    "return_as_file": false,
    "llm_translation": "",
    "srt_translation": "",
    "custom_vocabulary": "",
    "sentence_diarization": false,
    "word_level_timestamps": false,
    "sentence_level_timestamps": false
  },
  "webhook": "",
  "metadata": {
    "my-job-id": ""
  }
}

This is the input from the test run:

{
  "url": "https://api.salad.com/api/public/organizations/karavadra/inference-endpoints/transcribe/jobs",
  "body": {
    "data": {
      "input": {
        "srt": true,
        "url": "https://karavadra.net/shared/thequick.mp3",
        "summarize": 0,
        "translate": "to_eng",
        "diarization": true,
        "language_code": "en",
        "return_as_file": false,
        "llm_translation": "",
        "srt_translation": "",
        "custom_vocabulary": "",
        "sentence_diarization": false,
        "word_level_timestamps": false,
        "sentence_level_timestamps": false
      },
      "webhook": "",
      "metadata": {
        "my-job-id": ""
      }
    }
  },
  "method": "POST",
  "headers": {
    "Content-Type": "application/json",
    "Salad-Api-Key": "salad_cloud_user_pEpRMWbNUvbiWhQIdT745JzgrVJI29DbDENp3kd8Jky1iBUzS"
  },
  "failsafe": false,
  "body_type": "json",
  "use_proxy": false,
  "queryParams": {},
  "proxy_settings": {}
}

This is the exact output from the test run:

{"response":{"status":500,"body":""},"request":{"body":{"input":{"srt":true,"url":"https://karavadra.net/shared/thequick.mp3","summarize":0,"translate":"to_eng","diarization":true,"language_code":"en","return_as_file":false,"llm_translation":"","srt_translation":"","custom_vocabulary":"","sentence_diarization":false,"word_level_timestamps":false,"sentence_level_timestamps":false},"webhook":"","metadata":{"my-job-id":""}}}}

and here’s the same output made easier to read:

{
    "response": {
        "status": 500,
        "body": ""
    },
    "request": {
        "body": {
            "input": {
                "srt": true,
                "url": "https://karavadra.net/shared/thequick.mp3",
                "summarize": 0,
                "translate": "to_eng",
                "diarization": true,
                "language_code": "en",
                "return_as_file": false,
                "llm_translation": "",
                "srt_translation": "",
                "custom_vocabulary": "",
                "sentence_diarization": false,
                "word_level_timestamps": false,
                "sentence_level_timestamps": false
            },
            "webhook": "",
            "metadata": {
                "my-job-id": ""
            }
        }
    }
}

I’m going to update the support request to Salad with the comma syntax correction and the new 500 response.

Thank you for looking at this, it’s really appreciated.

Hmmm, this might just be a problem on Salad’s end. As you’ve probably seen on the page you linked: a 5xx status code implies the server processing your request messed up, if your request was somehow malformed you should get a 4xx like you did before.

No problem, sometimes all you need is a fresh pair of eyes :slight_smile:

@HoldYourWaffle for your info: after playing around with code, I realised that this bit was causing the 500 error:

             ,
            "webhook": "",
            "metadata": {
                "my-job-id": ""
            }

The API seems to respond OK after removing that (still full practical day to day use testing to be done).

So I’ve reported that to Salad and waiting for their advice.

Thanks again, it’s appreciated and yes fresh eyes usually help. On that note I’ll DM you in the next day or so about a simple yet hopefully effective idea for such fresh eyes and help.