• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

Getting Invalid API v1 key using POST method, but it's working using GET method.

heavytiger

Chevereto Noob
I tried GET method first, and it's working pretty well. But when I switch to POST method, I am getting below error:

Code:
{
    "status_code": 400,
    "error": {
        "message": "Invalid API v1 key.",
        "code": 100,
        "context": "Exception"
    },
    "status_txt": "Bad Request"
}

This is GET method:

Code:
curl --location --request GET 'https://example.com/api/1/upload/?key=bPl95An642nMwzdA5hxOqKzk9kRuHVeDT&source=https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg' \
--header 'Content-Type: application/json' \
--data-raw '{
    "key": "bPl95An642nMwzdA5hxOqKzk9kRuHVeDT",
    "source": "https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg",
    "format": "json"
}'

This is POST method.

Code:
curl --location --request POST 'https://example.com/api/1/upload/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "key": "bPl95An642nMwzdA5hxOqKzk9kRuHVeDT",
    "source": "https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg",
    "format": "json"
}'
 
You are wrongly passing the post fields as a JSON. That won't work with API V1, you need this command:

Code:
curl --location --request POST 'https://demo.chevereto.com/api/1/upload' \
--form 'key=XXXXXXXXXXXXX' \
--form 'source=https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg' \
--form 'format=json'

Note that curl is just an HTTP request, in the case of the demo I need to use this command (because of CloudFlare):

Code:
curl --location --request POST 'https://demo.chevereto.com/api/1/upload' \
--header 'Cookie: __cfduid=XXXXXXXX; PHPSESSID=XXXXXXXXXXXX' \
--form 'key=XXXXXXXXXXXXX' \
--form 'source=https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg' \
--form 'format=json'

Hope it helps.
 
You are wrongly passing the post fields as a JSON. That won't work with API V1, you need this command:

Code:
curl --location --request POST 'https://demo.chevereto.com/api/1/upload' \
--form 'key=XXXXXXXXXXXXX' \
--form 'source=https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg' \
--form 'format=json'

Note that curl is just an HTTP request, in the case of the demo I need to use this command (because of CloudFlare):

Code:
curl --location --request POST 'https://demo.chevereto.com/api/1/upload' \
--header 'Cookie: __cfduid=XXXXXXXX; PHPSESSID=XXXXXXXXXXXX' \
--form 'key=XXXXXXXXXXXXX' \
--form 'source=https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1297937920,2807167311&fm=26&gp=0.jpg' \
--form 'format=json'

Hope it helps.
I have tried your command, still getting the same error.
 
Sorry for not clarify, the issue is how you are using curl. Not Chevereto.
 
Back
Top