O
O
oooo_72022-02-23 09:27:56
AJAX
oooo_7, 2022-02-23 09:27:56

How to generate JSON from caught POST?

Good day. I caught a POST request from the site, please tell me how to make it in JavaScript (to send from the plugin).

await fetch("https://web.totalcoin.io/services/otc/api/v1/offers/update", {
    "credentials": "include",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0",
        "Accept": "application/json, text/plain, */*",
        "Accept-Language": "ru",
        "Authorization": "e34hbGciCtcE",
        "Content-ID-UUID": "6546-c456-456-a355-....",
        "Content-Type": "application/json;charset=utf-8",
        "Sec-Fetch-Dest": "empty",
        "Sec-Fetch-Mode": "cors",
        "Sec-Fetch-Site": "same-origin"
    },
    "referrer": "https://web.totalcoin.io/",
    "body": "{\"id\":\"b5b33db7-535c-4cdc-bd53-....\",\"paymentMethod\":{\"id\":732,\"name\":\"Tinkoff Bank\",\"currencyId\":\"USD\",\"currencyDisplayNameShort\":\"$\",\"icon\":\"https://img.totalcoin.io/upload/_pmc/176.png\",\"bestPriceSell\":43916.81,\"bestPriceBuy\":36647.32},\"price\":43500,\"limitMin\":50,\"limitMax\":3000,\"active\":false,\"user\":{\"id\":\"ef8be720-e12e-452b-a67c-....\",\"nickname\":\"DanilV\",\"confirmedCount\":14,\"refusedCount\":5,\"firstDealDate\":1616687528952,\"medianResponseTime\":0,\"okReviewCount\":11,\"badReviewCount\":0,\"textReviewCount\":4,\"totalValueTrade\":0.05888727,\"tradeVolume\":{\"BTC\":0.05888727},\"currency\":{\"id\":\"RUB\",\"displayNameShort\":\"р.\"},\"tradeEnabled\":true,\"currentUser\":true,\"isNickChanged\":true,\"timeoutAccept\":5,\"timeoutTransferConfirm\":30,\"timeoutOpenDispute\":15,\"userBlockedTimes\":1,\"verified\":false,\"proTrader\":false,\"isFavoriteUser\":false,\"favoriteUser\":false,\"nickChanged\":true},\"cryptocurrency\":\"BTC\",\"type\":\"BUY\",\"terms\":\"Баксы рубли\",\"autoLimit\":false,\"fixedPrice\":43500,\"partnerLimitType\":\"NO_LIMIT\",\"partnerLimitDealsTotal\":\"LIMIT_0\",\"partnerLimitTradeVolume\":\"LIMIT_0\",\"partnerLimitPercent\":0,\"feePercents\":null}",
    "method": "POST",
    "mode": "cors"
});


I'm not a programmer and I can do all this only on weekends from work, before asking a question, I tried to do it myself, using examples. Thanks in advance
. I understand that headers is written as an array, but I can’t compose everything correctly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2022-02-23
@Aleksandr-JS-Developer

What you put in the code tag is the JavaScript that will work (send (try to send) the request).
Remove the only thing await.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question