I am trying to convert results of an API call to JSON but not sure how to do that

library(httr)
library(rjson)

headers = c(
  'Content-Type' = 'application/json',
  'Authorization' = 'OAuth realm="586038",oauth_consumer_key="a616502f3f62c5c0a671aeb725e32ecd6014a1acd9d5340a2b36234cb0072d91",oauth_token="8637958205f2f6990544b14c13a9f6d9f2f4515ba1b21a",oauth_signature_method="HMAC-SHA256",oauth_timestamp="1706639789",oauth_nBtqpC6OtYpMCptp9ExZ8DJlM%3D"'
)

res <- VERB("GET", url = "https://586038.suitetalk.api.netsuite.com/services/rest/record/v1/customer/1764356", add_headers(headers))

results <- content(res)
print(results)


________________The response im getting is hex___________
 [1] 7b 22 74 79 70 65 22 3a 22 68 74 74 70 73 3a 2f 2f 77 77 77 2e 72 66 63 2d 65 64 69 74 6f 72 2e 6f
 [34] 72 67 2f 72 66 63 2f 72 66 63 39 31 31 30 2e 68 74 6d 6c 23 73 65 63 74 69 6f 6e 2d 31 35 2e 35 2e
 [67] 32 22 2c 22 74 69 74 6c 65 22 3a 22 55 6e 61 75 74 68 6f 72 69 7a 65 64 22 2c 22 73 74 61 74 75 73
[100] 22 3a 34 30 31 2c 22 6f 3a 65 72 72 6f 72 44 65 74 61 69 6c 73 22 3a 5b 7b 22 64 65 74 61 69 6c 22
[133] 3a 22 49 6e 76 61 6c 69 64 20 6c 6f 67 69 6e 20 61 74 74 65 6d 70 74 2e 20 46 6f 72 20 6d 6f 72 65
[166] 20 64 65 74 61 69 6c 73 2c 20 73 65 65 20 74 68 65 20 4c 6f 67 69 6e 20 41 75 64 69 74 20 54 72 61
[199] 69 6c 20 69 6e 20 74 68 65 20 4e 65 74 53 75 69 74 65 20 55 49 20 61 74 20 53 65 74 75 70 20 3e 20
[232] 55 73 65 72 73 2f 52 6f 6c 65 73 20 3e 20 55 73 65 72 20 4d 61 6e 61 67 65 6d 65 6e 74 20 3e 20 56
[265] 69 65 77 20 4c 6f 67 69 6e 20 41 75 64 69 74 20 54 72 61 69 6c 2e 22 2c 22

Does results <- content(res, as = "text") do what you want?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.