How to get/add attachment of sale & product in JSON

We are unable to get/add attachment of sale & product.
Can I know the API request/method for it?

I am tryting to make json api request.

Thank you,

All the attachments are stored on the _ir.attachmen_t model. The resource field is used as reference to the related method. So for getting all the attachments of a sale you have to perform a search on the ir.attachment model filtering with the records that have ‘,1’ for the resorce field (replacing 1 with the id of the sale you want to read.

The same applies for product by using the correct method.

Thank you for your answer
but still I am not clear with API request.

Can you give me an example for JSON?

Just use the search_read endpoint to read the data field and using
[(‘resource’, ‘=’, ‘,1’)] as domain.

ok, thank you for answer!

Also, can you let me know how to add attachment with any record?

Thank you,

You have to create a ir.attachment record with the resource field referencing the record.