nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches
rest_client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef REST_CLIENT_H__
8#define REST_CLIENT_H__
9
20#include <zephyr/kernel.h>
21#include <zephyr/net/http/client.h>
22#include <zephyr/net/http/parser.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29#define REST_CLIENT_TLS_DEFAULT_PEER_VERIFY -1
30
32#define REST_CLIENT_SCKT_CONNECT -1
33
47
59
62
65
70
73
75 const char *host;
76
78 uint16_t port;
79
81 const char *url;
82
86 const char **header_fields;
87
89 const char *body;
90
92 size_t body_len;
93
100 int32_t timeout_ms;
101
104
107};
108
118
121
123 char *response;
124
127
132 char http_status_code_str[HTTP_STATUS_STR_SIZE];
133
138
141
144};
145
160 struct rest_client_resp_context *resp_ctx);
161
170
171#ifdef __cplusplus
172}
173#endif
174
177#endif /* REST_CLIENT_H__ */
void rest_client_request_defaults_set(struct rest_client_req_context *req_ctx)
Sets the default values into a given request context.
rest_client_http_status
Common HTTP status codes.
Definition rest_client.h:35
@ REST_CLIENT_HTTP_STATUS_UNAUTH
Definition rest_client.h:41
@ REST_CLIENT_HTTP_STATUS_OK
Definition rest_client.h:37
@ REST_CLIENT_HTTP_STATUS_NOT_FOUND
Definition rest_client.h:45
@ REST_CLIENT_HTTP_STATUS_BAD_REQ
Definition rest_client.h:39
@ REST_CLIENT_HTTP_STATUS_FORBIDDEN
Definition rest_client.h:43
int rest_client_request(struct rest_client_req_context *req_ctx, struct rest_client_resp_context *resp_ctx)
REST client request.
enum http_method http_method
Definition rest_client.h:72
size_t body_len
Definition rest_client.h:92
int tls_peer_verify
Definition rest_client.h:69
const char * host
Definition rest_client.h:75
bool keep_alive
Definition rest_client.h:61
const char ** header_fields
Definition rest_client.h:86
uint16_t port
Definition rest_client.h:78
size_t resp_buff_len
Definition rest_client.h:106
const char * body
Definition rest_client.h:89
char * resp_buff
Definition rest_client.h:103
int connect_socket
Definition rest_client.h:58
int32_t timeout_ms
Definition rest_client.h:100
const char * url
Definition rest_client.h:81
int sec_tag
Definition rest_client.h:64
REST client request context.
Definition rest_client.h:54
int used_socket_is_alive
Definition rest_client.h:140
uint16_t http_status_code
Definition rest_client.h:126
char http_status_code_str[HTTP_STATUS_STR_SIZE]
Definition rest_client.h:132
size_t response_len
Definition rest_client.h:120
char * response
Definition rest_client.h:123
size_t total_response_len
Definition rest_client.h:117
int used_socket_id
Definition rest_client.h:137
struct rest_client_req_context * req_ctx
Definition rest_client.h:143
REST client response context.
Definition rest_client.h:115