hendt / ebay-api

eBay Node API in TypeScript for Node and Browser with RESTful and Traditional APIs. This library aims to implement all available eBay apis.
https://hendt.gitbook.io/ebay-api
MIT License
153 stars 41 forks source link

aspects in InventoryItem is now just a string #155

Closed zenith77 closed 1 year ago

zenith77 commented 1 year ago

Hi there,

@dantio - Thanks for the updates in 8.5.0.

Having started using 8.5.0 with the new generated types, the 'aspect' field of InventoryItem is now just a string and doesn't accept any json to describe the items various aspects.

Is there a chance you could look into it, please?

dantio commented 1 year ago

@zenith77 Do you mean the InventoryItem in createOrReplaceInventoryItem() call and the aspects prop inside the Product ? I see that eBay says it's a key/value pair and show also example with object. However, the type is string in OAS. I will submit this issue to eBay first before I try to patch it.

zenith77 commented 1 year ago

Brilliant - that is right. Sorry - I should've given you a bit more info, but you worked it out!

Thanks for looking into it.

zenith77 commented 1 year ago

@dantio hey there - have you heard anything back on this?

dantio commented 1 year ago

@zenith77 No response yet. I think you should use // @ts-ignore for now. I will think about how to monkey patch that thing.

zenith77 commented 1 year ago

@dantio - hi there, again. Yeah, that doesn't work either. I'm using the same format that I used before, and I now get 'Bad Request'.

Is there anything quick and easy you can do?

dantio commented 1 year ago

Oh I thought it works but with type Errors. Can you post how you do the API request?

zenith77 commented 1 year ago

This format used to work;

{
      "product": {
        aspects: {"Series Title": "Robotech"},
        "title": "DOCTOR FIBBLESWORTH #3 (OF 5)",
        "description": "Description blah blah blah",
        "imageUrls": [
          "https://ioa-images.s3.ap-southeast-2.amazonaws.com/asdasdasdwebp"
        ],
      }
dantio commented 1 year ago

Can You also Include the whole error response? I think the that issue is not about the type change. The only change is before it was type any and now it's string. But if you ignore the type check and put an object it should be the same as before.

zenith77 commented 1 year ago

I get this response...

[1] EBayAccessDenied: Invalid request [1] at handleEBayError (D:\Development\Projects\isleofavalon\server\node_modules\ebay-api\lib\errors\index.js:177:15) [1] at Inventory.request (D:\Development\Projects\isleofavalon\server\node_modules\ebay-api\lib\api\restful\index.js:183:44) [1] at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [1] at async Inventory.doRequest (D:\Development\Projects\isleofavalon\server\node_modules\ebay-api\lib\api\restful\index.js:141:20) { [1] description: 'The request has errors. For help, see the documentation for this API.', [1] meta: { [1] errorId: 2004, [1] domain: 'ACCESS', [1] category: 'REQUEST', [1] message: 'Invalid request', [1] longMessage: 'The request has errors. For help, see the documentation for this API.', [1] parameters: [ [Object] ], [1] res: { [1] status: 400, [1] statusText: 'Bad Request', [1] headers: [Object [AxiosHeaders]], [1] data: [Object] [1] }, [1] req: { [1] url: 'https://api.ebay.com/sell/inventory/v1/inventory_item/TEST-9688763c-f69f-4534-9008-87431946dd31', [1] method: 'put', [1] headers: [Object [AxiosHeaders]], [1] params: undefined [1] }, [1] [Symbol(raw-error)]: AxiosError: Request failed with status code 400 [1] at settle (D:\Development\Projects\isleofavalon\server\node_modules\axios\dist\node\axios.cjs:1913:12) [1] at Unzip.handleStreamEnd (D:\Development\Projects\isleofavalon\server\node_modules\axios\dist\node\axios.cjs:2995:11) [1] at Unzip.emit (node:events:525:35) [1] at Unzip.emit (node:domain:489:12) [1] at endReadableNT (node:internal/streams/readable:1359:12) [1] at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { [1] code: 'ERR_BAD_REQUEST', [1] config: [Object], [1] request: [ClientRequest], [1] response: [Object] [1] } [1] } [1] }

Response is fine and listing is created when aspect is omitted. That format above used to work in previous versions.

zenith77 commented 1 year ago

@dantio - so I reverted my code to 8.4.1, and now the old 'aspects' format that I was using doesn't work. So I suspect that ebay have altered the end points....?

Just rechecked the documentation and it says the format was different! That I had to array brackets to each item a la;

aspects: {"Series Title": ["Robotech Sasserfrasser"]}

And that seems to work - even in 8.6.0 with @ts-ignore.

Thanks for your help...!

dantio commented 1 year ago

I am glad that you found it out! Thank you for sharing this information.

zenith77 commented 1 year ago

@dantio sorry I couldn't work it out quicker - was pretty silly of me! :) Thanks for your patience and thanks again for the work you've done on this library :)