Search code examples
jelastic

Cannot import Jelastic Manifest with cURL command using two -H parameters


I'm trying to create a Jelastic Manifest with a cURL command inside it. When I import it, it gives me an error but unfortunately I have no access to the console (disabled by the provider).

The command is the following : curl -X POST <my_url> -H "Content-Type: application/json" -H "Authorization: Bearer <token>" -d "{}"

Some additionnal information :

  • The URL is correct 100%
  • The token does not contain any special characters : Only upper/lowercase characters and numbers
  • The command is run successfully from the command line
  • If I remove the first -H parameter, I can import my manifest. Same if I remove the second -H parameter and keep the first one

My guess is that, somehow, having two -H is not considered as valid but I don't know why. Any ideas ?

EDIT : A screenshot of the error shown on the platform

enter image description here


Solution

  • The "two -H parameters" wasn't a root cause in your question.

    The thing is that the YAML gets the data you sent as a key/value array (dictionary).

    In your example it would be:

    curl -s -X POST https://test.com -H "Content-Type - as a key,

    and

    application/json" -H "Authorization: Bearer xx" -d "{\"Key\":\"Value\"}" - as a value.

    If you need an array of strings the YAML may be as this

    cmd [cp]:
      - 'curl -s -X POST https://test.com -H "Content-Type: application/json" -H "Authorization: Bearer xx" -d "{\"Key\":\"Value\"}"'
    

    If you need a multi-line string it should look like this

    cmd [cp]: |
      curl -s -X POST https://test.com -H "Content-Type: application/json" -H "Authorization: Bearer xx" -d "{\"Key\":\"Value\"}"