When I use the below command
curlPerform(url = "Intranet URL Here",getURL("Intranet URL Here",userpwd = "USERID:PASSWORD",cainfo=system.file("CurlSSL","cacert.pem",package="RCurl")),
httpheader = headerfields,postfields = body,writefunction = reader$update)
I am getting the error message as mentioned below.
Error in curlOptions(..., .opts = .opts) : unnamed curl option(s): HTTP/1.1 404 Not Found
Page not foundPage not found
Could you please suggest me on this error. Thanks in advance.
I have used curl as below
reader = basicTextGatherer()
curl = getCurlHandle()
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"), followlocation = TRUE, httpheader = c(Accept = "text/xml",Accept = "multipart/*",'Content-Type' = "text/xml; charset=utf-8",SOAPAction="INTRANET URL"), userpwd = "USERID:PASSWORD", netrc = TRUE,timeout = 100, postfields = SOAP DETAILS, writefunction = reader$update, verbose=TRUE, curl = curl))
response <- getURL("INTRANET URL", curl=curl)
Related
I'm trying to create a subscription to the callRecords notifications with Graph API in R. I'm looking at this Microsoft page as a reference: https://learn.microsoft.com/en-us/graph/api/subscription-post-subscriptions?view=graph-rest-beta&tabs=http
Here is my code:
Subscribtion_Call <- AzureGraph::call_graph_endpoint(Tok, options = list(), api_version = Version, operation = "subscriptions", content_type = "application/json")
Subscription_Properties <- list(
changeType = "created,updated",
notificationUrl = "https://webhook.azurewebsites.net/notificationClient",
resource = "communications/callRecords",
expirationDateTime = "2022-04-09T11:00:00.0000000Z",
clientState = "SecretClientState"
)
Send_Subscription <- call_graph_url(Tok, Endpoint, body = Subscription_Properties, encode = "json",
content_type = "application/json",
http_verb = "POST",
http_status_handler = "message",
simplify = FALSE,
auto_refresh = TRUE
)
This gets me an HTTP 405 error as below:
> Subscribtion_Call <- AzureGraph::call_graph_endpoint(Tok, options = list(), api_version = Version, operation = "subscriptions", content_type = "application/json")
>
> Subscription_Properties <- list(
+ changeType = "created,updated",
+ notificationUrl = "https://webhook.azurewebsites.net/notificationClient",
+ resource = "communications/callRecords",
+ expirationDateTime = "2022-04-09T11:00:00.0000000Z",
+ clientState = "SecretClientState"
+ )
>
> Send_Subscription <- call_graph_url(Tok, Endpoint, body = Subscription_Properties, encode = "json",
+ content_type = "application/json",
+ http_verb = "POST",
+ http_status_handler = "message",
+ simplify = FALSE,
+ auto_refresh = TRUE
+ )
Method Not Allowed (HTTP 405). Failed to complete operation. Message:
.
If I change the http_verb to "GET" this is returned:
> Send_Subscription <- call_graph_url(Tok, Endpoint, body = Subscription_Properties, encode = "json",
+ content_type = "application/json",
+ http_verb = "GET",
+ http_status_handler = "message",
+ simplify = FALSE,
+ auto_refresh = TRUE
+ )
OK (HTTP 200). Failed to complete operation. Message:
.
>
What am I missing?
Thanks in advance for your help!
How can I get all the tracks from a spotify playlist in r?
this is what i tried but it doesnt work
response = POST(
'https://accounts.spotify.com/api/token',
accept_json(),
authenticate(clientID, secret),
body = list(grant_type = 'client_credentials'),
encode = 'form',
verbose()
)
token = content(response)$access_token
authorization.header = paste0("Bearer ", token)
#Get track info#
call1 <- GET(url = "https://api.spotify.com/v1/playlists/{53Y8wT46QIMz5H4WQ8O22c}", config = add_headers(authorization = authorization.header))
call1
Hi Can anyone know how to troubleshoot this.
url = "https://www.zillow.com/walnut-ca/?searchQueryState=%7B%22pagination%22%3A%7B%7D%2C%22usersSearchTerm%22%3A%22Walnut%2C%20CA%22%2C%22mapBounds%22%3A%7B%22west%22%3A-117.93482729053105%2C%22east%22%3A-117.75286623096073%2C%22south%22%3A33.93783156520187%2C%22north%22%3A34.06392018234896%7D%2C%22isMapVisible%22%3Atrue%2C%22mapZoom%22%3A12%2C%22filterState%22%3A%7B%22price%22%3A%7B%22min%22%3A400000%2C%22max%22%3A700000%7D%2C%22mp%22%3A%7B%22min%22%3A1448%2C%22max%22%3A2535%7D%2C%22sort%22%3A%7B%22value%22%3A%22globalrelevanceex%22%7D%7D%2C%22isListVisible%22%3Atrue%7D"
d = {'key':'value'}
print(d)
d['new key'] = 'new value'
print(d)
query_houses = {}
house_no = 0
while True:
response = requests.get(url)
data = response.text
soup = BeautifulSoup(data,'html.parser')
houses = soup.find_all('article',{'class':'list-card list-card-short list-card_not-saved'})
for house in houses:
location = house.find('address',{'class': 'list-card-addr'})
value = house.find('div',{'class': 'list-card-price'})
detail = house.find('ul', {'class':'list-card-details'})
seller = house.find('div',{'class':'list-card-truncate'})
link = house.find('a', {'class': 'list-card-link'}).get('href')
house_response = requests.get(link)
house_data = house_response.text
house_soup = BeautifulSoup(house_data, 'html.parser')
square = house_soup.find('span',{'class':'ds-bed-bath-living-area'})
year_build = house_soup.find('span',{'class':'ds-body ds-home-fact-value'})
estimated_sales_range = house_soup.find('div',{'class':'Spacer-sc-17suqs2-0 pfWXf'})
house_no+=1
query_houses[house_no] = [location, value, detail, seller, link, square, year_build, estimated_sales_range]
url_tag = soup.find('a',{'title':'Next-page'})
if url_tag.get('href'):
url= 'https://zillow.com' + url_tag.get('href')
print(url)
else:
break
When working with Swagger Annotations it is not possible to create an example for the request body.
Here comes the annotation stuff for the RESTful resource/endpoint:
#POST
#Path("/{carId}/conversation")
#ApiImplicitParams({
#ApiImplicitParam(name = "Authorization", value = "The AppJWT token", paramType = "header", required = true),
#ApiImplicitParam(name = "ON-BEHALF", value = "The ConsumerJWS token", paramType = "header", required = true),
#ApiImplicitParam(name = "v", value = "API version", defaultValue = "3", paramType = "query", required = true)
})
#ManagedAsync
#ApiOperation(value = "bla", notes = "")
#ApiResponses(value = {
#ApiResponse(code = 200, message = "bla", response = CreateBlaResponse.class, responseContainer = "List"),
#ApiResponse(code = 400, message = "The input was invalid, please check.", response = GenericError.class),
#ApiResponse(code = 401, message = "Unauthorized. Are the headers correct?"),
#ApiResponse(code = 429, message = "Too many requests, please try again later", response = CreateConversationResBody.class)
})
public void createConversationBatchPOST(#ApiParam(value = "Car ID the action should apply to", required = true) #PathParam("carId") String carId,
#ApiParam(name = "body", value = "The Json payload", required = true, examples = #Example(value = {#ExampleProperty(value = "{\"name\" : \"James\"}", mediaType = "application/json")}))
#RequestBody String body,
#Suspended final AsyncResponse asyncResponse) throws IOException {
//.... implementation
}
Do you have an idea why the annotation in the method signature
#ApiParam(name = "body", value = "The Json payload",
required = true, examples = #Example(value = {#ExampleProperty(value = "{\"name\" : \"James\"}", mediaType = "application/json")}))
#RequestBody String body
doesn't lead to the Json example?
I am trying to send different contents to different recipients, but all recipients get all contents. Any help?
library(mailR)
msg<- data.frame(recipients=c("first#mail.com","second#mail.com","third#mail.com"),
messages=c("firstmsg","secondmsg","thirdmsg"))
for ( i in msg$recipients)
{
for (j in msg$messages) {
send.mail(from="myemail#mail.com",
to= i,
body = j,
subject = "subject",
encoding = "utf-8",
smtp= list(host.name = "smtp.gmail.com", port = 465,
user.name = "myemail#mail.com", passwd = "mypassword", ssl = TRUE),
authenticate = TRUE, send = TRUE, attach.files=NULL, debug = FALSE)
}
}
You are using a double loop which will go through each value of j for each value of i in your loop. One approach would be to use list indexing:
msg<-data.frame(recipients=c("first#mail.com","second#mail.com",
"third#mail.com"),messages=c("firstmsg","secondmsg","thirdmsg"))
for i in 1:nrow(msg)
{
send.mail(from="myemail#mail.com",
to= msg$recipients[i],
body = msg$message[i],
subject = "subject",
encoding = "utf-8",
smtp= list(host.name = "smtp.gmail.com", port = 465,
user.name = "myemail#mail.com", passwd = "mypassword", ssl = TRUE),
authenticate = TRUE, send = TRUE, attach.files=NULL, debug = FALSE)
}