-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_post_request.R
16 lines (9 loc) · 3.61 KB
/
main_post_request.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
library(httr)
get_main_listings <- function() {
headers = c(
'Content-Type' = 'application/json'
)
body = '{"query":"query SearchQuery($q: String, $filter: SearchFilterInput, $mediaSize: MediaSize = MEDIUM) {\\r\\n search(q: $q, filter: $filter) {\\r\\n announcements {\\r\\n data {\\r\\n ...AnnouncementContent\\r\\n smallDescription {\\r\\n valueText\\r\\n __typename\\r\\n }\\r\\n noAdsense\\r\\n __typename\\r\\n }\\r\\n paginatorInfo {\\r\\n lastPage\\r\\n hasMorePages\\r\\n __typename\\r\\n }\\r\\n __typename\\r\\n }\\r\\n active {\\r\\n category {\\r\\n id\\r\\n name\\r\\n slug\\r\\n icon\\r\\n delivery\\r\\n priceUnits\\r\\n children {\\r\\n id\\r\\n name\\r\\n slug\\r\\n __typename\\r\\n }\\r\\n specifications {\\r\\n isRequired\\r\\n specification {\\r\\n id\\r\\n codename\\r\\n label\\r\\n type\\r\\n class\\r\\n datasets {\\r\\n codename\\r\\n label\\r\\n __typename\\r\\n }\\r\\n dependsOn {\\r\\n id\\r\\n codename\\r\\n __typename\\r\\n }\\r\\n subSpecifications {\\r\\n id\\r\\n codename\\r\\n label\\r\\n type\\r\\n __typename\\r\\n }\\r\\n allSubSpecificationCodenames\\r\\n __typename\\r\\n }\\r\\n __typename\\r\\n }\\r\\n parentTree {\\r\\n id\\r\\n name\\r\\n slug\\r\\n icon\\r\\n children {\\r\\n id\\r\\n name\\r\\n slug\\r\\n icon\\r\\n __typename\\r\\n }\\r\\n __typename\\r\\n }\\r\\n parent {\\r\\n id\\r\\n name\\r\\n icon\\r\\n __typename\\r\\n }\\r\\n __typename\\r\\n }\\r\\n count\\r\\n __typename\\r\\n }\\r\\n suggested {\\r\\n category {\\r\\n id\\r\\n name\\r\\n slug\\r\\n __typename\\r\\n }\\r\\n count\\r\\n __typename\\r\\n }\\r\\n __typename\\r\\n }\\r\\n}\\r\\n\\r\\nfragment AnnouncementContent on Announcement {\\r\\n id\\r\\n title\\r\\n slug\\r\\n createdAt: refreshedAt\\r\\n isFromStore\\r\\n isCommentEnabled\\r\\n userReaction {\\r\\n isBookmarked\\r\\n isLiked\\r\\n __typename\\r\\n }\\r\\n hasDelivery\\r\\n deliveryType\\r\\n likeCount\\r\\n description\\r\\n status\\r\\n cities {\\r\\n id\\r\\n name\\r\\n slug\\r\\n region {\\r\\n id\\r\\n name\\r\\n slug\\r\\n __typename\\r\\n }\\r\\n __typename\\r\\n }\\r\\n store {\\r\\n id\\r\\n name\\r\\n slug\\r\\n imageUrl\\r\\n __typename\\r\\n }\\r\\n defaultMedia(size: $mediaSize) {\\r\\n mediaUrl\\r\\n __typename\\r\\n }\\r\\n price\\r\\n pricePreview\\r\\n priceUnit\\r\\n oldPrice\\r\\n priceType\\r\\n exchangeType\\r\\n __typename\\r\\n}\\r\\n","variables":{"mediaSize":"MEDIUM","q":null,"filter":{"categorySlug":"automobiles","origin":null,"connected":false,"delivery":null,"regionIds":[],"cityIds":[],"priceRange":[null,null],"exchange":false,"hasPictures":false,"hasPrice":true,"priceUnit":null,"fields":[],"page":1,"count":48}}}'
res <- VERB("POST", url = "https://api.ouedkniss.com/graphql", body = body, add_headers(headers))
return(res)
}