Azure CosmosDB REST error creating documentPhysical partitions - Azure CosmosDBDocumentDB Rest API - create document needs id for new documentsAzure Cosmos DB stored procedure not returning documentsError creating HttpTrigger Azure Function with CosmosDB document outputAzure CosmosDb create partition onlyPostman: Cannot Create Document with Azure MongoDB APIUsing multiple consumers with CosmosDB change feedHow to create a collection in a shared throughput cosmosdb using the Mongo APIAzure function inserting but not updating cosmosDBCosmosDB Container without PartitionKey

What does "another" mean in this case?

What are the differences of checking a self-signed certificate vs ignore it?

Go function to test whether a file exists

Does a reference have a storage location?

What is meaning of 4 letter acronyms in Roman names like Titus Flavius T. f. T. n. Sabinus?

Upload csv into QGIS

Can you move between the attacks of a Twinned Booming Blade?

Olive oil in Japanese cooking

Has there ever been a cold war other than between the U.S. and the U.S.S.R.?

Cannot update a field to a Lookup, MasterDetail, or Hierarchy from something else (44:13)

My players like to search everything. What do they find?

My mother co-signed for my car. Can she take it away from me if I am the one making car payments?

"Best practices" for formulating MIPs

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

Bypass with wrong cvv of debit card and getting OTP

How can solar sailed ships be protected from space debris?

Can I have a forest in the rain shadow of a mountain range?

Which are more efficient in putting out wildfires: planes or helicopters?

Which high-degree derivatives play an essential role?

In National Velvet why didn't they use a stunt double for Elizabeth Taylor?

Who are the police in Hong Kong?

Phrase origin: "You ain't got to go home but you got to get out of here."

Did Snape really give Umbridge a fake Veritaserum potion that Harry later pretended to drink?

How frequently do Russian people still refer to others by their patronymic (отчество)?



Azure CosmosDB REST error creating document


Physical partitions - Azure CosmosDBDocumentDB Rest API - create document needs id for new documentsAzure Cosmos DB stored procedure not returning documentsError creating HttpTrigger Azure Function with CosmosDB document outputAzure CosmosDb create partition onlyPostman: Cannot Create Document with Azure MongoDB APIUsing multiple consumers with CosmosDB change feedHow to create a collection in a shared throughput cosmosdb using the Mongo APIAzure function inserting but not updating cosmosDBCosmosDB Container without PartitionKey






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I'm getting the following error when trying to create a document using the REST API:



The input content is invalid because the required properties - 'id; ' - are missing


In the various SDKs there is an optional parameter to include, disableAutomaticIdGeneration, which if set to true will reject a request with this error if an ID is not supplied. I'm making a pretty bare REST request, so I'm not adding this parameter myself (and I don't even know what header -- presumably a header -- I would add because the documentation for the REST API doesn't cover it).



The only extra thing to note is that the collection has a defined partition key. I can't find any documentation that says that an ID is required if a partition key is defined, but that appears to be the case.



Unless someone can answer as to why this is/could be happening, I'm going to consider my "it-must-be-defined-if-partition-key-is-defined" answer the answer eventually.



Request below (it's not the bare HTTP, but those are the contents):




"headers":
"content-type": "application/json",
"x-ms-version": "2017-02-22",
"x-ms-date": "Mon, 25 Mar 2019 17:57:03 GMT"
,
"body":
"data": "myData",
// "id": "some_id" //I don't want to do this because I want Cosmos to auto-generate this like when I create a document in the Portal!
,
"method": "post",
"url": "https://my-database-server.documents.azure.com/dbs/MyDatabase/colls/MyCollection/docs"



A few more questions to untangle...



The Create a Document documentation states that id is Required, so maybe the Portal is actually creating it browser-side and then including it in the request under the hood, but if that was the case why does the disableAutomaticIdGeneration option exist in the SDKs?



Also, the same documentation states (highlighting is mine):




It is the unique ID that identifies the document, that is, no two documents should share the same id. The id must not exceed 255 characters. The ID field is automatically added when a document is created without specifying the ID value. However, you can always update the ID value by assigning a custom value to it in the request body.




By the bolded-section, it seems like the key id is required, but maybe I can pass a null or empty string? But, I tried both of those and got errors both times (one saying that null was not allowed and the other was that the string cannot be empty).










share|improve this question




























    1















    I'm getting the following error when trying to create a document using the REST API:



    The input content is invalid because the required properties - 'id; ' - are missing


    In the various SDKs there is an optional parameter to include, disableAutomaticIdGeneration, which if set to true will reject a request with this error if an ID is not supplied. I'm making a pretty bare REST request, so I'm not adding this parameter myself (and I don't even know what header -- presumably a header -- I would add because the documentation for the REST API doesn't cover it).



    The only extra thing to note is that the collection has a defined partition key. I can't find any documentation that says that an ID is required if a partition key is defined, but that appears to be the case.



    Unless someone can answer as to why this is/could be happening, I'm going to consider my "it-must-be-defined-if-partition-key-is-defined" answer the answer eventually.



    Request below (it's not the bare HTTP, but those are the contents):




    "headers":
    "content-type": "application/json",
    "x-ms-version": "2017-02-22",
    "x-ms-date": "Mon, 25 Mar 2019 17:57:03 GMT"
    ,
    "body":
    "data": "myData",
    // "id": "some_id" //I don't want to do this because I want Cosmos to auto-generate this like when I create a document in the Portal!
    ,
    "method": "post",
    "url": "https://my-database-server.documents.azure.com/dbs/MyDatabase/colls/MyCollection/docs"



    A few more questions to untangle...



    The Create a Document documentation states that id is Required, so maybe the Portal is actually creating it browser-side and then including it in the request under the hood, but if that was the case why does the disableAutomaticIdGeneration option exist in the SDKs?



    Also, the same documentation states (highlighting is mine):




    It is the unique ID that identifies the document, that is, no two documents should share the same id. The id must not exceed 255 characters. The ID field is automatically added when a document is created without specifying the ID value. However, you can always update the ID value by assigning a custom value to it in the request body.




    By the bolded-section, it seems like the key id is required, but maybe I can pass a null or empty string? But, I tried both of those and got errors both times (one saying that null was not allowed and the other was that the string cannot be empty).










    share|improve this question
























      1












      1








      1








      I'm getting the following error when trying to create a document using the REST API:



      The input content is invalid because the required properties - 'id; ' - are missing


      In the various SDKs there is an optional parameter to include, disableAutomaticIdGeneration, which if set to true will reject a request with this error if an ID is not supplied. I'm making a pretty bare REST request, so I'm not adding this parameter myself (and I don't even know what header -- presumably a header -- I would add because the documentation for the REST API doesn't cover it).



      The only extra thing to note is that the collection has a defined partition key. I can't find any documentation that says that an ID is required if a partition key is defined, but that appears to be the case.



      Unless someone can answer as to why this is/could be happening, I'm going to consider my "it-must-be-defined-if-partition-key-is-defined" answer the answer eventually.



      Request below (it's not the bare HTTP, but those are the contents):




      "headers":
      "content-type": "application/json",
      "x-ms-version": "2017-02-22",
      "x-ms-date": "Mon, 25 Mar 2019 17:57:03 GMT"
      ,
      "body":
      "data": "myData",
      // "id": "some_id" //I don't want to do this because I want Cosmos to auto-generate this like when I create a document in the Portal!
      ,
      "method": "post",
      "url": "https://my-database-server.documents.azure.com/dbs/MyDatabase/colls/MyCollection/docs"



      A few more questions to untangle...



      The Create a Document documentation states that id is Required, so maybe the Portal is actually creating it browser-side and then including it in the request under the hood, but if that was the case why does the disableAutomaticIdGeneration option exist in the SDKs?



      Also, the same documentation states (highlighting is mine):




      It is the unique ID that identifies the document, that is, no two documents should share the same id. The id must not exceed 255 characters. The ID field is automatically added when a document is created without specifying the ID value. However, you can always update the ID value by assigning a custom value to it in the request body.




      By the bolded-section, it seems like the key id is required, but maybe I can pass a null or empty string? But, I tried both of those and got errors both times (one saying that null was not allowed and the other was that the string cannot be empty).










      share|improve this question














      I'm getting the following error when trying to create a document using the REST API:



      The input content is invalid because the required properties - 'id; ' - are missing


      In the various SDKs there is an optional parameter to include, disableAutomaticIdGeneration, which if set to true will reject a request with this error if an ID is not supplied. I'm making a pretty bare REST request, so I'm not adding this parameter myself (and I don't even know what header -- presumably a header -- I would add because the documentation for the REST API doesn't cover it).



      The only extra thing to note is that the collection has a defined partition key. I can't find any documentation that says that an ID is required if a partition key is defined, but that appears to be the case.



      Unless someone can answer as to why this is/could be happening, I'm going to consider my "it-must-be-defined-if-partition-key-is-defined" answer the answer eventually.



      Request below (it's not the bare HTTP, but those are the contents):




      "headers":
      "content-type": "application/json",
      "x-ms-version": "2017-02-22",
      "x-ms-date": "Mon, 25 Mar 2019 17:57:03 GMT"
      ,
      "body":
      "data": "myData",
      // "id": "some_id" //I don't want to do this because I want Cosmos to auto-generate this like when I create a document in the Portal!
      ,
      "method": "post",
      "url": "https://my-database-server.documents.azure.com/dbs/MyDatabase/colls/MyCollection/docs"



      A few more questions to untangle...



      The Create a Document documentation states that id is Required, so maybe the Portal is actually creating it browser-side and then including it in the request under the hood, but if that was the case why does the disableAutomaticIdGeneration option exist in the SDKs?



      Also, the same documentation states (highlighting is mine):




      It is the unique ID that identifies the document, that is, no two documents should share the same id. The id must not exceed 255 characters. The ID field is automatically added when a document is created without specifying the ID value. However, you can always update the ID value by assigning a custom value to it in the request body.




      By the bolded-section, it seems like the key id is required, but maybe I can pass a null or empty string? But, I tried both of those and got errors both times (one saying that null was not allowed and the other was that the string cannot be empty).







      azure azure-cosmosdb






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 18:21









      MandMMandM

      2,0102 gold badges25 silver badges46 bronze badges




      2,0102 gold badges25 silver badges46 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          3














          The current SDKs auto-generate missing ids as Guid values. The Azure Portal uses the JS SDK, that is why you see the Portal experience creating the id for you if you don't add it.



          The documentation on the REST API seems misleading and needs to be adjusted from what you share, since the REST API won't autogenerate the id, it will validate that it's in the payload though.



          In summary, if you are implementing your own REST client, you can add your own autogenerate logic client-side (like the SDKs do), the REST API requisite is that it's included in the payload.






          share|improve this answer























          • Thanks for the answer Matias!

            – MandM
            Mar 26 at 11:41










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344254%2fazure-cosmosdb-rest-error-creating-document%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          The current SDKs auto-generate missing ids as Guid values. The Azure Portal uses the JS SDK, that is why you see the Portal experience creating the id for you if you don't add it.



          The documentation on the REST API seems misleading and needs to be adjusted from what you share, since the REST API won't autogenerate the id, it will validate that it's in the payload though.



          In summary, if you are implementing your own REST client, you can add your own autogenerate logic client-side (like the SDKs do), the REST API requisite is that it's included in the payload.






          share|improve this answer























          • Thanks for the answer Matias!

            – MandM
            Mar 26 at 11:41















          3














          The current SDKs auto-generate missing ids as Guid values. The Azure Portal uses the JS SDK, that is why you see the Portal experience creating the id for you if you don't add it.



          The documentation on the REST API seems misleading and needs to be adjusted from what you share, since the REST API won't autogenerate the id, it will validate that it's in the payload though.



          In summary, if you are implementing your own REST client, you can add your own autogenerate logic client-side (like the SDKs do), the REST API requisite is that it's included in the payload.






          share|improve this answer























          • Thanks for the answer Matias!

            – MandM
            Mar 26 at 11:41













          3












          3








          3







          The current SDKs auto-generate missing ids as Guid values. The Azure Portal uses the JS SDK, that is why you see the Portal experience creating the id for you if you don't add it.



          The documentation on the REST API seems misleading and needs to be adjusted from what you share, since the REST API won't autogenerate the id, it will validate that it's in the payload though.



          In summary, if you are implementing your own REST client, you can add your own autogenerate logic client-side (like the SDKs do), the REST API requisite is that it's included in the payload.






          share|improve this answer













          The current SDKs auto-generate missing ids as Guid values. The Azure Portal uses the JS SDK, that is why you see the Portal experience creating the id for you if you don't add it.



          The documentation on the REST API seems misleading and needs to be adjusted from what you share, since the REST API won't autogenerate the id, it will validate that it's in the payload though.



          In summary, if you are implementing your own REST client, you can add your own autogenerate logic client-side (like the SDKs do), the REST API requisite is that it's included in the payload.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 25 at 19:39









          Matias QuarantaMatias Quaranta

          5,01412 silver badges30 bronze badges




          5,01412 silver badges30 bronze badges












          • Thanks for the answer Matias!

            – MandM
            Mar 26 at 11:41

















          • Thanks for the answer Matias!

            – MandM
            Mar 26 at 11:41
















          Thanks for the answer Matias!

          – MandM
          Mar 26 at 11:41





          Thanks for the answer Matias!

          – MandM
          Mar 26 at 11:41








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344254%2fazure-cosmosdb-rest-error-creating-document%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현