Categories
Mastering Development

Swift 5 & Alamofire 5 : GET method ERROR: Alamofire.AFError.URLRequestValidationFailureReason.bodyDataInGETRequest(22 bytes)

I am trying to get records from Database using Alamofire. I am sending parameters in GET request as below. let headers : HTTPHeaders = [“x-access-token”: “\(t)”,”username”:”\(Base.sharedManager.user)”,”password”:”\(Base.sharedManager.pass)”] let parm : [String: Any] = [“search_str” : self!.searchStr] // let searchUrl = Base.sharedManager.URL+”questions/get/”+self!.searchStr let searchUrl = Base.sharedManager.URL+”questions/get/” AF.request(searchUrl, method: .get, parameters: parm, encoding:JSONEncoding.default , headers: headers, interceptor: nil).response […]

Categories
Mastering Development

How to resolve CORS policy issue in Ionic Angular app?

I am trying to execute the below function in my Ionic Angular app, cloudFunctionUrl is a cloud function I have in my firebase project: import { HttpClient } from ‘@angular/common/http’; private http: HttpClient like(post) { this.http.post(‘cloudFunctionUrl’, JSON.stringify(body), { responseType: ‘text’ }).subscribe((data) => { console.log(data); }, (error) => { console.log(error); }); } To get over the […]

Categories
Mastering Development

Python requests with bearer token returns 401

I have api when called using Postman returns 200 and expected data. Similarly when urllib is used it returns 200 but fails when used requests. Note – All methods work correctly on external url but return 401 on localhost urllib code(returns 200): r = request.Request(myUrl) r.add_header(‘Accept’, ‘application/json’) r.add_header(‘Authorization’, f’Bearer {self.AUTH_TOKEN}’) response = request.urlopen(r, context=self.ctx) requests […]

Categories
Mastering Development

Concert R GET method into Python

I am new to Python; currently, I need to convert the below R code to Python, I know I need to use requests library; however, I don`t know how to convert the authenticate(cibc_username, cibc_password,”gssnegotiate”) into Python. So, could anyone help me to resolve it? The R code below: hr_page = GET(url, user_agent(“””Mozilla/5.0 (Windows NT 10.0; […]

Categories
Mastering Development

2 API Calls in One JavaScript

presently I am attempting to make 2 different api calls one after the other within 1 java/nodejs script. It seems after my first function runs successfully, the second one errors with the following: FetchError: request to failed, reason: socket hang up; type: ‘system’, errno: ‘ECONNRESET’, code: ‘ECONNRESET’ Below is a code snippet of what I […]

Categories
Mastering Development

Need to get project/issues from JIRA using JIRA REST API with NodeJS

I am building a NodeJS application from where I want to get project/issues from JIRA using REST APIs provided by JIRA. My jira is running on some server (‘http://example.com:8080/secure/Dashboard.jspa‘) and I am able to use REST APIs from POSTMAN using BASIC AUTH to get all kind of data but when I tried to log in […]

Categories
Development

API call GET request for metrics data

So I’m currently trying to figure out how to fetch data using Nielsen’s API given a unique ID (ISRC) for a track/song. I have the documentation which include headers, path parameters and body parameters. I’m not so familiar with making calls to APIs and so any help trying to find the best solution will be […]

Categories
Development

Unsubscribe on Mailchimp with a Google App Script API

I adapted the following google app script code to unsubscribe an email from a list on MailChimp. Similar code, allows me to add a subscriber but when I try to modify a member’s details or change the status to unsubscribed. I get an error: “title”:”Member Exists”,”status”:400,”detail”:”example@example.com is already a list member. Use PUT to insert […]

Categories
Development

java.net.UnknownHostException: Unable to resolve host “api.themoviedb.org

I’m getting this error message “java.net.UnknownHostException: Unable to resolve host “api.themoviedb.org”: No address associated with hostname”. All the stackoverflow posts I read said that the manifest file might be wrong, but I think at this point it’s right, so I’m not sure how to continue. AndroidManifest.xml: <?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:android=”http://schemas.android.com/apk/res/android” package=”com.example.flixster”> <uses-permission android:name=”android.permission.INTERNET”/> <uses-permission […]

Categories
CMS Development Wordpress

problem using wp_remote_post

I am sending the following request $params[‘upload’] = new CURLFile( $file_path ); $args = array( ‘method’ => ‘POST’, ‘headers’ => $headers, ‘body’ => $params, ); $data = wp_remote_post( $url, $params ); but in the class the data changes $data = http_build_query($data, null, ‘&’); class Requests_Transport_cURL (cURL.php protected function setup_handle ) code from class if (!empty($data)) […]