Concern curl bash file

Solved
cave2180 Posted messages 512 Status Member -  
cave2180 Posted messages 512 Status Member -
Hello,

I have a problem with the curl command on Ubuntu
"curl: (3) Illegal characters found in URL"

Here is my script:

#/bin/sh
ref='https://gestion.domain.fr/api/index.php/products/25'
curl -X PUT --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'APIKEY: cleapi' -d '{"price": "45"}' $ref

Yet my URL is correct and without special characters.

Thank you in advance

Configuration: Windows / Firefox 70.0

2 answers

  1. jordane45 Posted messages 30426 Registration date   Status Moderator Last intervention   4 830
     
    Hello,

    Is this the real URL?
    Have you tested it (via Postman for example)?

    Try doing this before the curl call
     ref=${ref%$'''} 


    --
    Best regards,
    Jordane
    0
    1. cave2180 Posted messages 512 Status Member 6
       
      For the URL, just the domain, I keep it confidential.
      The command works in the terminal but not in the script...
      I added the line and it works right away, I completely forgot the carriage return...
      Thanks :p
      0