Discussion Forum: Thread 319585

 Author: scud80 View Messages Posted By scud80
 Posted: Apr 8, 2022 23:32
 Subject: API: /inventories?status= not working
 Viewed: 76 times
 Topic: Technical Issues
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

scud80 (1463)

Location:  USA, California
Member Since Contact Type Status
Mar 13, 2018 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store: Cephalopod Creations
I've just started working with the API. I can retrieve data, but currently
the request I want to make doesn't work. I want to use my C stockroom to
mess around with things before trying to update live inventory, but the status
parameter for inventories returns a code 401 SIGNATURE_INVALID (for any status
value, not just C). Retrieval works totally fine if I use item_type, color_id,
or category_id as the parameter. Any ideas?
 Author: macebobo View Messages Posted By macebobo
 Posted: Apr 9, 2022 02:58
 Subject: Re: API: /inventories?status= not working
 Viewed: 39 times
 Topic: Technical Issues
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

macebobo (2433)

Location:  USA, Oregon
Member Since Contact Type Status
Apr 3, 2016 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store: MacsBricks
In Technical Issues, scud80 writes:
  I've just started working with the API. I can retrieve data, but currently
the request I want to make doesn't work. I want to use my C stockroom to
mess around with things before trying to update live inventory, but the status
parameter for inventories returns a code 401 SIGNATURE_INVALID (for any status
value, not just C). Retrieval works totally fine if I use item_type, color_id,
or category_id as the parameter. Any ideas?

Two fields need to be set to put in or take out inventory to/from your stockroom.
The is_stock_room needs to be set to true or false and stock_room_id would be
A, B, or C when true and blank when false.
 Author: scud80 View Messages Posted By scud80
 Posted: Apr 9, 2022 16:16
 Subject: Re: API: /inventories?status= not working
 Viewed: 37 times
 Topic: Technical Issues
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

scud80 (1463)

Location:  USA, California
Member Since Contact Type Status
Mar 13, 2018 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store: Cephalopod Creations
I'm not trying to add/remove inventory yet. I'm just trying to retrieve
the contents of the inventory.

  Two fields need to be set to put in or take out inventory to/from your stockroom.
The is_stock_room needs to be set to true or false and stock_room_id would be
A, B, or C when true and blank when false.
 Author: beaverbrick View Messages Posted By beaverbrick
 Posted: Apr 9, 2022 18:13
 Subject: Re: API: /inventories?status= not working
 Viewed: 29 times
 Topic: Technical Issues
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

beaverbrick (566)

Location:  United Kingdom, England
Member Since Contact Type Status
Jan 2, 2014 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store Closed Store: Brick Beaver
In Technical Issues, scud80 writes:
  I've just started working with the API. I can retrieve data, but currently
the request I want to make doesn't work. I want to use my C stockroom to
mess around with things before trying to update live inventory, but the status
parameter for inventories returns a code 401 SIGNATURE_INVALID (for any status
value, not just C). Retrieval works totally fine if I use item_type, color_id,
or category_id as the parameter. Any ideas?

Just tested this and it's working OK. Tested a few times with different
stockrooms and worked every time.

A '401 Signature Invalid' error would suggest it's more a problem
with the way you're building the request/making the call... which is odd
if it works OK when using the other parameters.

Only thing I can think of is the sort order of all the parameters.
So the program should have (values omitted)...
oauth_timestamp
oauth_nonce
oauth_version
oauth_signature_method
oauth_consumer_key
oauth_token
status (the stockroom flag)

All of these parameters need to be sorted in to alphabetical order before being
encoded and added to the URL. The 3 parameters that work all come before 'oauth'
alphabetically, but 'status' comes after. Your program may not have
sorting (or 'manual sorting', simply based on the order the parameters
are written in the code).
 Author: scud80 View Messages Posted By scud80
 Posted: Apr 9, 2022 18:37
 Subject: Re: API: /inventories?status= not working
 Viewed: 51 times
 Topic: Technical Issues
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

scud80 (1463)

Location:  USA, California
Member Since Contact Type Status
Mar 13, 2018 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store: Cephalopod Creations
yep, that's what did it. i was adding the method parameters and then the
authorization parameters when building the signature instead of all of them together.
thanks!

In Technical Issues, beaverbrick writes:
  In Technical Issues, scud80 writes:
  I've just started working with the API. I can retrieve data, but currently
the request I want to make doesn't work. I want to use my C stockroom to
mess around with things before trying to update live inventory, but the status
parameter for inventories returns a code 401 SIGNATURE_INVALID (for any status
value, not just C). Retrieval works totally fine if I use item_type, color_id,
or category_id as the parameter. Any ideas?

Just tested this and it's working OK. Tested a few times with different
stockrooms and worked every time.

A '401 Signature Invalid' error would suggest it's more a problem
with the way you're building the request/making the call... which is odd
if it works OK when using the other parameters.

Only thing I can think of is the sort order of all the parameters.
So the program should have (values omitted)...
oauth_timestamp
oauth_nonce
oauth_version
oauth_signature_method
oauth_consumer_key
oauth_token
status (the stockroom flag)

All of these parameters need to be sorted in to alphabetical order before being
encoded and added to the URL. The 3 parameters that work all come before 'oauth'
alphabetically, but 'status' comes after. Your program may not have
sorting (or 'manual sorting', simply based on the order the parameters
are written in the code).