Sending Header information?

Hello!
I really don’t understand how to make my code work as “action” in my GPT . The call I have created is first created through Postman. I’ve managed to make the correct call in Swaggereditor as well. When I try to paste the code in “actions” for my gpt, I get an error message. I don’t know how to get the TenantName : value
in a header?

The worked code in Swagger is "

  1. openapi: 3.1.0
  2. info:
  3. title:My API
  4. description: fjkhf
  5. version: ‘1.0.0’
  6. servers:
  7. paths:
  8. /CreateDocument:
  9. post:
    
  10.   summary: Skapa ett nytt dokument
    
  11.   operationId: createDocument
    
  12.   requestBody:
    
  13.     required: true
    
  14.     content:
    
  15.       application/json:
    
  16.         schema:
    
  17.           type: object
    
  18.           properties:
    
  19.             CategoryNo:
    
  20.               type: integer
    
  21.               example: 14
    
  22.             IndexDataItems:
    
  23.               type: array
    
  24.               items:
    
  25.                 type: object
    
  26.                 properties:
    
  27.                   StringIndexData:
    
  28.                     type: object
    
  29.                     properties:
    
  30.                       FieldNo:
    
  31.                         type: integer
    
  32.                       DataValue:
    
  33.                         type: string
    
  34.                       FieldName:
    
  35.                         type: string
    
  36.           required:
    
  37.             - CategoryNo
    
  38.             - IndexDataItems
    
  39.           example:
    
  40.             CategoryNo: 14
    
  41.             IndexDataItems:
    
  42.               - StringIndexData:
    
  43.                   FieldNo: 300
    
  44.                   DataValue: "Förbättringsförslag/Avvikelse"
    
  45.                   FieldName: "rendetyp"
    
  46.               - StringIndexData:
    
  47.                   FieldNo: 301
    
  48.                   DataValue: "Kvalitet"
    
  49.                   FieldName: "TWF287"
    
  50.               - StringIndexData:
    
  51.                   FieldNo: 303
    
  52.                   DataValue: "LG-Teknik"
    
  53.                   FieldName: "TWF283"
    
  54.               - StringIndexData:
    
  55.                   FieldNo: 308
    
  56.                   DataValue: "user.name"
    
  57.                   FieldName: "TWF288"
    
  58.               - StringIndexData:
    
  59.                   FieldNo: 302
    
  60.                   DataValue: "Här skriver jag min avvikelse..."
    
  61.                   FieldName: "TWF298"
    
  62.             CheckInComments: "Ny ärendehantering registrering"
    
  63.   responses:
    
  64.     '200':
    
  65.       description: Dokument skapat framgångsrikt
    
  66.       content:
    
  67.         application/json:
    
  68.           schema:
    
  69.             type: object
    
  70.             properties:
    
  71.               documentId:
    
  72.                 type: string
    
  73.                 example: "123456"
    
  74.     '400':
    
  75.       description: Felaktig begäran
    
  76.     '401':
    
  77.       description: Obehörig
    
  78.   security:
    
  79.     - basicAuth: []
    
  80.   parameters:
    
  81.     - name: TenantName
    
  82.       in: header
    
  83.       required: true
    
  84.       schema:
    
  85.         type: string
    
  86.       example: MYTENANT
    
  87. components:
  88. securitySchemes:
  89. basicAuth:
    
  90.   type: http
    
  91.   scheme: basic
    
  92. "

The result of my “actions” is

" In components section, schemas subsection is not an object

In path /CreateDocument, method post, operationId createDocument, parameter TenantName has location header; ignoring"

Should I choose another method for “Authentication” to be able to send with “TenantName : mytenantName” in the header? Or how should I doPreformatted text

The docs for custom actions make clear that custom HTTP headers are currently not supported. Also, if you want to receive feedback on your OpenAPI specification, you should really format it in a readable code block. :slightly_smiling_face:

1 Like

Thank you for your response. Okay, I tried to understand it by reading, googling, and asking ChatGPT. Apparently, I missed that part, even though I spent around 5-6 hours trying. As for formatting the code, how do I do that?

1 Like

Found it here by accident, I have not even yet built my own Action:

  • Custom headers are not supported

https://platform.openai.com/docs/actions/getting-started#:~:text=Custom%20headers%20are%20not%20supported


Enclose your code with three backticks (```). Apparently there is no formatting button for this in the editor:

```
code
```