Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by m-y · Aug 25, 2021 at 01:18 AM · unityeditorapirequestput

Put Request Like PostMan , How to do it ?

Hello , I am trying to use Put Method like Postman , But I can't Figure out the problem I was looking everywhere , and they always use in string parameter rawdata and what is rawdata content ? I don't know Here is my use in Postman and here is my try in unity So Help please , Thanks

PostMan alt text

Here is my try in Unity

     IEnumerator PutRequest()
     {
         
         using (UnityWebRequest www = UnityWebRequest.Put("http://0000000/smallapi2/products?id=1", "{'name':Chipsy,'product_price':12,'productPurchasedCounter':142}"))
         { 
             www.SetRequestHeader("Content-Type", "application/json");
             www.SetRequestHeader("Accept", "text/json");
             yield return www.SendWebRequest();
             try
             {
                 if (www.isNetworkError)
                 {
                     Debug.Log("PUT ERROR: " + www.error);
                 }
                 else
                 {
 
                     Debug.Log(www.uploadHandler);
                     Debug.Log("Uploaded!!");
                 }
             }
             catch (Exception)
             {
 
                 Debug.Log("NO QORY");
             }
 
         }
     }

postman1.png (31.4 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by xxmariofer · Aug 25, 2021 at 07:04 AM

whats the error returned? I doubt using single ' is valid in json format, you should be using " (you can scape the character like this: \") Also I have never seen doing a GET and a PUT in the same request, is that possible?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image m-y · Aug 25, 2021 at 10:32 AM 0
Share

can you write it to me in correct format without problem in unity ? where is GET request here ?

avatar image xxmariofer m-y · Aug 25, 2021 at 11:32 AM 0
Share
 "{\"name\":\"Chipsy\",\"product_price\":12,\"productPurchasedCounter\":142}"

this is an example, remember that all strings (chipsy also) needs to be between ""

the Get is probably not an issue and maybe Im simply mistaken, but the main differnet between Get and PUT/POST is that the parameters go in the url like in your example (?id=1) I have never seen that, but I am far from being a web developer expert, I dont understand why wouldnt you simply add the id=1 in the json with the rest of the parameters, but maybe is there a hidden reason I dont understand

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

170 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity Tools - How could I make a login system or api like paid assets? 0 Answers

Unity 2019.4.3 steamvr asset pack - HMD/controllers not being used, defaults to stereo display 1 Answer

Is there a replacement for AssetDatabase.CanOpenAssetEditor 0 Answers

How to integrate Google APIs functionality for Sign=in/Login purpose in unity2017? 0 Answers

,Call api and wait answer to return (async?) 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges