No announcement yet.

REST API Getting Manufacturers Returns Bad Request

  • Filter
  • Time
  • Show
Clear All
new posts

  • REST API Getting Manufacturers Returns Bad Request

    We're trying to retrieve manufacturers by name (via the REST service) and we're getting an http 400 response back, but we don't know why. I've pasted the redacted request and response below.

    GET HTTP/1.1
    Accept: application/json
    privatekey: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Connection: Keep-Alive
    HTTP/1.1 400 Bad Request
    Cache-Control: no-cache
    Pragma: no-cache
    Content-Type: application/json; charset=utf-8
    Expires: -1
    X-AspNet-Version: 4.0.30319
    Access-Control-Allow-Origin: *
    Date: Mon, 13 Jun 2016 16:03:51 GMT
    Content-Length: 37

    {"Message":"The request is invalid."}
    Please let us know what we're doing wrong or if there's a problem with the service.


  • #2
    According to documentation, the route either supports a get all via /manufacturers (without a subroute) or a git single manufacturer by id via /manufacturers/:id. The request is bad because the name of the manufacturer is not the id.. its not even an integer.. so it can't validate the request.


    • #3
      Thanks for the response. The documentation:
      ​Says there is a URI parameter called "manufacturer" which is what we're using (it's after the ? in the URL as part of the query string).


      • #4
        File a ticket if you think it's a bug in the API. The REST API is fairly new compared to the SOAP API, so there could be a few kinks to still work out. We have a ticket filed for a missing field when calling GET 3dCartWebAPI/v1/Products/{catalogid}. The missing field is: ShowOutStock


        • #5
          centrolutions I apologize, it looks like you can call em via the query string param like you are doing, but i see a couple issues.

          1) you shouldnt end the request with an & unless you are going to add another filter param on the end.
          2) you should make sure to always encode 2 part names. They might be expecting a space rather than a plus.
          3) offset =1 advances the results by 1 (essentially giving you the second index position), if your limit is 1 and you try to reach the second index, that could cause an issue.

          Try adjusting your request in postman in regards to the above mentioned things (postman will encode the url for you) and you may have more success.
          Last edited by jleclair; 06-16-2016, 01:25 PM.


          • #6
            Thanks to everyone that responded. We've tried several variations of parameters and encoding and nothing has worked. We'll be submitting a bug report shortly.