Hello Dear Coders,
I want to post request with my web api and this way my web site can create an order.
When i tried this method in kodular it is worked! but not for all datas.
Here is my kodular blocks;
Web url format is: https://example.com/ /wp-json/wc/v3/orders?consumer_key=ck_xxxx&consumer_secret=cs
With above blocks i can succesfully post with main array which are “payment_method”,“set_paid”,“payment_method_title” but i can not post first name, last name under the “billing” array. How can i run this ?,
The api intruction is in below,
Try PostText with a string of parameters:
.PostText text > join > firstname=tttt&lastname=zzz&city=yyy
(note no question mark needed for the first parameter when using PostText)
Hello they are sub strings i have already try this it is not working what is your suggestion to run sub strings ?
Create your POST parameters with Join .
Can you explain more detaily with block ?
If I must…
If as you say, these are substrings, you may need to either:
- add an “&” to the first item parameter
- Place all of your parameters in your posttext join block
I have tried your method posting funciton is working but sub string is data first name is not posted.
Main string is “billing”
and sub string is “first-name” and this is what i tried;
you didn’t add a value to the billing parameter…
yes i am trying to add for first name value but first name string is under string to billing data.
In this block remove & and try
It will print as first name=text box.text
sorry, did not worked. and it does not make sense because in my json data both under the billing object and shipping object includes “first_name” string.
I am sorry, I have not being paying attention! You probably need to manually create a json string for your “substring”. Back in a minute with an example here…
Like this ?
You may need to post all your parameters in a json string…
you also have to set the Content-Type in the request header…
your Content-Type is
see an example here App Inventor Tutorials and Examples: Dropbox | Pura Vida Apps
and you have to put together your json string manually as @TimAi2 already mentioned…
Hello Dear All,
I have tried all your methods what you told me but never worked. What is my fault ?
Here is my blocks.
Here is documantetion about api;
Remove the single quotes from the beginning and end of your JSON string?
Try billing outside of the JSON with an equals sign ?
did not worked. As i said before, all main object i can post but sub strings i could not posted.
follow @TimAi2 's advice…
and post a screenshot of your complete JSON string… where are your substrings?
also use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
and then you might want to verify your JSON string in an online tools like https://jsonlint.com/
in the end your JSON string must look like exactly as in the example
Please , can you tell me how can i setup but not for header but for the Body ? Is it Possible to setup not the header but the Body with by example ==> Content-Type ?