Cloud API added
[apps/native/gear-racing-car.git] / inc / cloud / http_request.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://floralicense.org/license/
9  *
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.
15  */
16
17 #ifndef __HTTP_REQUEST_H_
18 #define __HTTP_REQUEST_H_
19
20 /**
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.
27  */
28 int http_request_get(const char *url, char **response, long *response_code);
29
30 /**
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.
38  */
39 int http_request_post(const char *url, const char *json, char **response, long *response_code);
40
41 #endif