# Confluent cloud REST proxy for producing data

**URL:** <https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151>\
**Category:** REST Proxy\
**Created:** [14 February 2022 04:30 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151 "2022-02-14T04:30:21Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)\
**Post date:** [14 February 2022 04:30 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/1 "2022-02-14T04:30:21Z")

</div>

Hello,

I am using confluent cloud and can see REST Endpoint in cluster settings. I believe it just supports v3 services of confluent’s REST proxy. I’m referring to [CC API reference](https://docs.confluent.io/cloud/current/api.html) but I do not see anything related to producing record to topic with REST proxy.

My intention is to check if via REST endpoint can clients produce data with validating schema registry both AVRO as well as JSON data?

In every document of data prodution via REST PROXY v1 I can see just AVRO validating schema not JSON data. Even for AVRO I tried [these steps](https://docs.confluent.io/platform/current/kafka-rest/api.html#post--clusters-cluster_id-topics-topic_name-records) but getting following error :

> {  
> “error\_code”: 405,  
> “message”: “HTTP 405 Method Not Allowed”  
> }

Please help me with the documentation or steps to test these scenarios.

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [14 February 2022 07:06 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/2 "2022-02-14T07:06:20Z")

</div>

Hi @shubhamshirur

afaik it’s not implemented

see [Can't produce to Confluent Kafka topic through Kafka REST API - Stack Overflow](https://stackoverflow.com/questions/70673888/cant-produce-to-confluent-kafka-topic-through-kafka-rest-api)

maybe ksqldb cli could be a workaround, see the blog post by @rmoff

> **[Connecting to managed ksqlDB in Confluent Cloud with REST and ksqlDB CLI](https://rmoff.net/2021/03/24/connecting-to-managed-ksqldb-in-confluent-cloud-with-rest-and-ksqldb-cli/)**

best,  
michael

---

<div class="post-metadata">

**Author:** ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)\
**Post date:** [14 February 2022 08:43 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/3 "2022-02-14T08:43:31Z")

</div>

Thanks for the quick response.

I thought implementing REST server as a separate component on prem pointing to confluent cloud would help, now I am able to produce data via REST endpoint on prem into confluent cloud referring [v2 implementation](https://docs.confluent.io/platform/current/kafka-rest/quickstart.html#produce-and-consume-avro-messages).

But if I try to invoving AVRO messages or JSONSCHEMA (i.e. with schema registry), it is throwing error

After manually adding schema and trying to add with schema id reference.

```auto
{
    "error_code": 40801,
    "message": "Error when fetching schema by id. schemaId = 100175"
}

```

Before registering schema, trying to produce with schema itself.

```auto
{
  "error_code": 40801,
  "message": "Error when registering schema. format = AVRO, subject = dummy-value, schema = {\"type\":\"record\",\"name\":\"User\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"}]}"
}

```

But if I am not adding AVRO or JSONschema, it is simply getting produced into topic.

Not sure if schema registry issue or cloud specific?

If it is resolvable I can go with it, in parallel I am trying solution provided by you mentioned in @rmoff’s blog,

Can you please guide here.

Thanks.

---

<div class="post-metadata">

**Author:** ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)\
**Post date:** [14 February 2022 10:16 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/4 "2022-02-14T10:16:02Z")

</div>

Also, not sure why but I am getting **403 CORS rejected request - invalid origin** error when I am trying to POST request as shown in @rmoff’s blog you mentioned in conversation.

Please enlight in this case.

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [14 February 2022 15:20 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/5 "2022-02-14T15:20:38Z")

</div>

> [@shubhamshirur](#):
>
> **403 CORS rejected request**

did you login properly?

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [14 February 2022 15:21 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/6 "2022-02-14T15:21:44Z")

</div>

hey  
maybe you schema is wrong  
how does it look like?

best,  
michael

---

<div class="post-metadata">

**Author:** ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)\
**Post date:** [14 February 2022 17:06 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/8 "2022-02-14T17:06:21Z")

</div>

I could validate and save schema to the topic… and tried to use its schema registry.  
It is simple dummy schema.

```auto
{
	"name": "User",
	"type": "record",
	"fields": [
	{
		"type":"string",
		"name":"name"
	}
	]
}

```

I think this is not the problem with schema. Otherwise schema registry would not have allowed me to register.

And yes I think I no problem in authentication too, because when I checked **ksql-endpoint/info** step it is giving me result. Just issue while operations.  
Not sure where I am mistaking.

---

<div class="post-metadata">

**Author:** ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)\
**Post date:** [14 February 2022 17:08 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/9 "2022-02-14T17:08:34Z")

</div>

And as I mentioned I am able to produce data via self managed REST PROXY into confluent cloud.

But throwing error while registering schemas, not sure why.

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [16 February 2022 06:53 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/10 "2022-02-16T06:53:55Z")

</div>

ok I see  
how does you rest proxy config look like?

how do you try to produce the data?

best,  
michael

---

<div class="post-metadata">

**Author:** ![shubhamshirur](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@shubhamshirur](https://forum.confluent.io/u/shubhamshirur)\
**Post date:** [16 February 2022 08:04 UTC](https://forum.confluent.io/t/confluent-cloud-rest-proxy-for-producing-data/4151/11 "2022-02-16T08:04:59Z")

</div>

REST Config :

> bootstrap.servers=xxxxxxxxxxxx:9092  
> security.protocol=SASL\_SSL  
> sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule   
> required username=“” password=“”;  
> ssl.endpoint.identification.algorithm=https  
> sasl.mechanism=PLAIN  
> client.bootstrap.servers=.cloud:9092  
> client.security.protocol=SASL\_SSL  
> client.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule   
> required username=“” password=“”;  
> client.ssl.endpoint.identification.algorithm=https  
> client.sasl.mechanism=PLAIN  
> schema.registry.url=xxxxxxxxxxxxxxxx  
> basic.auth.credentials.source=USER\_INFO  
> schema.registry.basic.auth.user.info=schema-registry-api-key:schema-registry-api-secret

Referring [this.](https://docs.confluent.io/cloud/current/cp-component/kafka-rest-config.html)

And trying to produce exactly like [this.](https://docs.confluent.io/platform/current/kafka-rest/quickstart.html#produce-and-consume-avro-messages)

For JSON - [this](https://docs.confluent.io/platform/current/kafka-rest/quickstart.html#produce-and-consume-json-messages) is working fine.  
Thanks.
