// Query is executing a HTTP request
Query is executing a HTTP request
// Query is executing a HTTP request
func (conn *Connection) Query(method string, url string) (result []byte, err error) {
	endpoint := conn.InstanceUrl + "/services/data/v" + conn.APIVersion + url
	req, err := http.NewRequest(method, endpoint, nil)
	if err != nil {
		return result, err
	}
	req.Header.Add("Authorization", "Bearer "+conn.AccessToken)
	req.Header.Add("Content-Type", "application/json")
	client := &http.Client{}
	resp, err := client.Do(req)
	if err != nil {
		return result, err
	}
	defer resp.Body.Close()
	result, err = ioutil.ReadAll(resp.Body)
	if err != nil {
		return result, err
	}
	return result, nil
}
func ( conn * Connection ) Query ( method string , url string ) ( result [ ] byte , err error ) { endpoint := conn . InstanceUrl + " " + conn . APIVersion + url req , err := http . NewRequest ( method , endpoint , nil ) if err != nil { return result , err } req . Header . Add ( " " , " " + conn . AccessToken ) req . Header . Add ( " " , " " ) client := & http . Client { } resp , err := client . Do ( req ) if err != nil { return result , err } defer resp . Body . Close ( ) result , err = ioutil . ReadAll ( resp . Body ) if err != nil { return result , err } return result , nil }
Query is executing a HTTP request
Query is executing a HTTP request