2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __HTTP_REQUEST_H_
18 #define __HTTP_REQUEST_H_
21 * @brief Generic HTTP GET.
22 * @param[in] url Url of request.
23 * @param[out] response Response from the request.
24 * @param[out] response_code HTTP response code.
25 * @return Returns 0 on success, -1 otherwise.
26 * @remarks Response should be released with @free.
28 int http_request_get(const char *url, char **response, long *response_code);
31 * @brief Generic HTTP POST.
32 * @param[in] url URL of request.
33 * @param[in] json Content of the response in json format.
34 * @param[out] response Response from the request.
35 * @param[out] response_code HTTP response code.
36 * @return Returns 0 on success, -1 otherwise.
37 * @remarks Response should be released with @free.
39 int http_request_post(const char *url, const char *json, char **response, long *response_code);