ovistoica
11/19/2024, 11:56 AMVapi
11/19/2024, 11:59 AMjson
{
"type": "conversation",
"instruction": "Ask the user for his name."
}
Make sure to include this as a JSON payload in the body of your POST request, and also include the necessary headers such as 'Authorization' and 'Content-Type'. If you continue to experience issues, please provide more details or ask support for more info on this.Vapi
11/19/2024, 11:59 AMovistoica
11/19/2024, 12:05 PMjavascript
client.blocks.create({type: "conversation", instruction: "Ask the user for his name."}).then((res) => console.log(res))
And api call
bash
curl -X POST https://api.vapi.ai/block \
-H "Authorization: Bearer " \
-H "Content-Type: application/json" \
-d '{
"type": "conversation",
"instruction": "Ask user for his name"
}'
Vapi
11/19/2024, 12:05 PM/blocks
instead of /block
. Additionally, ensure that you have a valid access token in the "Authorization" header.
Here's the corrected TypeScript SDK code:
javascript
client.blocks.create({type: "conversation", instruction: "Ask the user for his name."})
.then((res) => console.log(res))
.catch((error) => console.error(error));
And the corrected cURL command:
bash
curl -X POST https://api.vapi.ai/blocks \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "conversation",
"instruction": "Ask the user for his name"
}'
Make sure to replace YOUR_ACCESS_TOKEN
with your actual access token. If you're still encountering a 500 error after these adjustments, it could be an issue on the server side or with the access token. Please check the server response body for any error messages that can provide more details, and if necessary, reach out to the API support for further assistance.ovistoica
11/19/2024, 12:07 PM/block
as per the api documentation.Vapi
11/19/2024, 12:07 PM/block
as per the API documentation. If you're still receiving a 500 Internal Server Error, it indicates that there's an issue on the server side that you cannot resolve on your own.
Here are a few steps you can take to troubleshoot the issue:
1. Double-check the API documentation to ensure that all required parameters are included in your request.
2. Verify that the API key is valid and has the necessary permissions to create a block.
3. Look for any additional error messages in the server's response body, as they may provide more insight into what's going wrong.
4. If possible, enable any logging or debugging features provided by the API to get more detailed error information.
If after these steps the issue persists, it's best to contact the API support team with the details of your request and the error you're receiving. They will be able to provide more specific guidance and help resolve the issue.
In the meantime, if there's anything else I can assist you with, please let me know!ovistoica
11/19/2024, 12:09 PMBody: {
"statusCode": 500,
"message": "Internal server error"
}
ovistoica
11/19/2024, 12:09 PMVapi
11/19/2024, 12:09 PMovistoica
11/19/2024, 4:01 PM