Adam
Adam

Reputation: 15

Nodejs Smartsheet API Error when trying to move row to another sheet

I have been working on a simple production management process based around smartsheet. The code that I have been running has been working fine on my Ubuntu machine, then I copied it over to my Parrot Linux machine running the same node version and it won't find a row that exists. Below is the request:

      var copyRow = {
        "rowIds": artToProdRowsToCopy,
        "to": {
          "sheetId": productionId
        }
      };

      // Set options
      var options = {
        sheetId: artId,
        body: copyRow,
        queryParameters: {
          include: "all"
        }
      };
      console.log(options);
      // Copy the normal engraved rows from art to production
      smartsheet.sheets.copyRowToAnotherSheet(options)
        .then(function(results) {
          callback1(null, results);
        })
        .catch(function(error) {
          console.log(error);
        });

The log output of options:

{ sheetId: 8129017524546436,
  body: 
   { rowIds: [ 8886954296800644 ],
      to: { sheetId: 6941481487333252 } },
   queryParameters: { include: 'all' } }

The error:

{ statusCode: 404,
  errorCode: 1006,
  message: 'Not Found',
  refId: 'zjl2z56296l9' }

I'm running node v8.9.1, on Parrot Linux 3.9.

I've checked that each of these sheet and row ID #'s are correct and they all are (the ones in the examples are not real however). Any help would be appreciated.

Edit: Adding debug info:

[Smartsheet] 2017-11-20T20:22:55.876Z[   INFO] POST https://api.smartsheet.com/2.0/sheets/8129017124546436/rows//copy?include=all
[Smartsheet] 2017-11-20T20:22:55.876Z[VERBOSE] Request Payload (preview): {"rowIds":[2759271070885764,3212501789763460,4576920289470340,8982631438149508,2962733838690180,8886959296800644],"to":{"sheetId":6941441487333252}}
[Smartsheet] 2017-11-20T20:22:55.876Z[  DEBUG] Request Payload (full): {"rowIds":[2759271070885764,3212501789763460,4576920289470340,8982631438149508,2962733838690180,8886959296800644],"to":{"sheetId":6941441487333252}}
[Smartsheet] 2017-11-20T20:22:56.155Z[  ERROR] Request failed after 0 retries
[Smartsheet] 2017-11-20T20:22:56.156Z[  ERROR] POST https://api.smartsheet.com/2.0/sheets/8129017124546436/rows//copy?include=all
[Smartsheet] 2017-11-20T20:22:56.156Z[  ERROR] Response: Failure (HTTP 404)
Error Code: 1006 - Not Found
Ref ID: 85bn0m2j8oki

Upvotes: 0

Views: 445

Answers (3)

Steve Weil
Steve Weil

Reputation: 873

Looks like our SDK bug. Stay tuned for a fix.

Upvotes: 0

Kim Brandl
Kim Brandl

Reputation: 13480

I don't see any obvious issues with your request structure. Typically, the 404 Not Found error is related to an issue with the request URI, rather than the contents of the request itself. i.e., a 404 Not Found error means that, for some reason or another, the request URI is not reachable.

The URI for the Copy Row(s) request is:

POST /sheets/{sheetId}/rows/copy

A few troubleshooting suggestions:

  • Verify that the casing of all characters in the request URI are lowercase.

  • Verify that the sheet corresponding to the sheetId value in the request URI exists.

  • Verify that the user who owns the API Access token that you're specifying in the Authorization header of the Copy Row(s) API request does indeed have access to the sheet corresponding to the sheetId value in the request URI.

As described in the Troubleshooting section of the API docs, I'd suggest that you use a tool like Fiddler or Charles HTTP Proxy to examine the raw HTTP request that your app is sending, then you can investigate/verify the items I've listed above.

Update #1

Thanks for updating your post with debugging info. Based on that, it looks like your request URI contains an extra slash between the words rows and copy:

POST https://api.smartsheet.com/2.0/sheets/8129017124546436/rows//copy?include=all

Perhaps this is causing your problem?

Update #2

I've been able to reproduce the Not Found error in Postman if my Request URI contains two slashes between the words rows and copy(like your debug output shows). Removing one of these slashes fixes the issue. That is, your request should look like this (only one slash between the words rows and copy).

POST https://api.smartsheet.com/2.0/sheets/8129017124546436/rows/copy?include=all

Upvotes: 1

Related Questions