Question

Having trouble testing out the legacy basic auth api...

I want to mature this into nodejs or php, for a blog interface, but I can't seem to get the cURL working properly.

I believe I am following their docs... but who knows.

curl --request POST \
    -H "Content-Type: application/json" \
    -u "user:key" \
    -d '{"title": "title", "content": "content"}' \
    https://myteststoreurl.mybigcommerce.com/api/v2/blog/posts

I get an empty response when I attempt the following with my person info added in...

When I run

curl --request GET \
    -H "Content-Type: application/json" \
    -u "user:key" \
    https://myteststoreurl.mybigcommerce.com/api/v2/blog/posts

I get all current posts, correctly. But POST will not work. Also, when updating a post with PUT, it removes the post from the interface but does send the change which I can verify by running the get request.

Any Bigcommerce experts to help out here??

Was it helpful?

Solution 2

I believe you are doing this from windows and where single quote makes the problem. Change your -d values.

-d "{title\": \"title\", \"content\": \"content\"}"

Also add the -v parameter to see what is curl sending when you perform the request.

OTHER TIPS

This is actually an internal server issue with Bigcommerce API. Even when you type the correct curl command, you receive a 500 error. When running verbose, typing -v, you'll notice.

It looks like a syntax error to me. On you d value when posting the initial double quote for title is on the wrong side of the curly brace. Try this.

curl --request POST \ 
    -H "Content-Type: application/json" \ 
    -u "user:key" \ 
    -d '{"title": "title", "content": "content"}' \ 
    https://myteststoreurl.mybigcommerce.com/api/v2/blog/posts

Try the same request with something like Advanced REST client (Chrome app) https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

If you are still getting the same error most likely it's a Bigcommerce API side issue.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top