Ordersinfo Is Empty -- Can't Find Order With Id

Discussion in 'Shapeways API' started by PeregrineStudios, May 2, 2020.

  1. PeregrineStudios
    PeregrineStudios Well-Known Member
    I'm trying to set up an automatic order import through the API so I can import Shapeways orders into a financial dashboard app. I'm using PHP, Guzzle, and OAuth2Middleware to connect to the API:

    $reauthClient = new Client([
    'base_uri' => 'https://api.shapeways.com/oauth2/token'
    ]);

    $reauthConfig = [
    'client_id' => config('services.shapeways.client_id'),
    'client_secret' => config('services.shapeways.client_secret'),
    ];

    $oauth = new OAuth2Middleware(new ClientCredentials($reauthClient, $reauthConfig));

    $stack = HandlerStack::create();
    $stack->push($oauth);

    $client = new Client([
    'auth' => 'oauth',
    'handler' => $stack
    ]);

    $response = json_decode($client->get('https://api.shapeways.com/orders/v1')->getBody()->getContents());
    This successfully connects to the API without any authentication errors, however, in the response I get back, `orderinfo` is null, and my order counts are all zero:

    {#2845
    +"result": "success"
    +"ordersCount": {#2857
    +"total": 0
    +"placed": 0
    +"in_production": 0
    +"cancelled": 0
    +"unknown": 0
    +"shipped": 0
    }
    +"ordersStatus": []
    +"ordersInfo": null
    +"nextActionSuggestions": {#2851
    +"url": "offset=20"
    }
    }​

    If I try to access an order I know exists, like so:


    Then I receive a 400 bad request response:

    {"result":"failure","reason":"No orders found for your app with orderId [3386368]"}​

    Any ideas? Why can't my app see my orders?
     
  2. stonysmith
    stonysmith Well-Known Member Moderator
    Are these orders from a customer, or your own orders from your account?
    The API for bulk ordering thru your own account, not for monitoring customer orders.
     
  3. PeregrineStudios
    PeregrineStudios Well-Known Member
    I am specifically looking for orders that I have placed -- either manually on Shapeways, or through the Etsy integration (it's still my account that places the orders in that case). Even if that weren't the case, I certainly wouldn't expect to see my order totals be zero across the board -- my account has personally placed, literally, thousands of orders over the years.

    I was able to find a sales .csv to download, but that is for sales to customers, not orders placed through my account.
     
  4. PeregrineStudios
    PeregrineStudios Well-Known Member
    The API team got back to me and explained that API apps can only see orders created by that same app.

    Even the barest hint of that in the documentation would be nice. All it says about the orders endpoint is that it can be used to retrieve your orders.
     
  5. bikeracer85
    bikeracer85 Member
    Thank you for following up, @PeregrineStudios — I'm running into the same exact problem right now.

    I was trying to download all of the orders I've placed this year through the orders/v1 endpoint and was getting nothing back. Was convinced I was querying the API incorrectly ‍♂️.

    Did you ever find a way to download all of your order information?