Issue with Post Text Request

Hi,

I am trying to integrate a third party API which works in a very weird way.
I need to send the data in request body in exactly below format.
board= [["7","3","7","1","0","0","1","0","0"],["1",0,3,4,4,0,5,7,0],[5,0,0,2,5,0,0,0,0],[0,0,4,0,5,5,0,0,0],[3,0,0,7,9,0,0,0,0],[7,9,8,0,1,3,3,0,5],[0,0,1,0,0,0,9,5,6],[6,6,5,9,0,3,7,0,1],[9,7,8,5,7,6,0,3,1]]
First I tried by constructing dictionary and then i realised that instead of regular symbol between key/value ':', the API is expecting "=".
So i changed the dictionary to text but I am still facing the problem due to (") before the board key word. attached below is the snap shot of the request body. Please refer the curly braces before the word board in DO IT window. Please suggest if there is any way or workaround to handle this issue.
Thanks

It would help if you had a working string to show us.

I notice from your sample that you mix quoted and unquoted values,
so I assume that's okay.

I see in your sample that you use "0" as the value for an empty cell, however the Do It value has an empty string instead.

I don't see any {} in your Do It text . ???

The space in your target sample after the '=' looks unhelpful.

Sorry for not being clear in my earlier post. I will try to explain the problem below.
Below is the DO IT text
Do It Result: "board=[["6", "1", "1", "", "4", "", "5", "", ""], ["", "3", "", "2", "", "", "", "", ""], ["", "", "", "1", "", "", "", "", "4"], ["", "", "", "4", "7", "5", "", "", ""], ["4", "", "", "3", "", "", "1", "", "7"], ["7", "9", "8", "6", "", "2", "", "4", "5"], ["3", "2", "", "", "8", "", "", "", "6"], ["", "", "5", "9", "2", "", "", "1", ""], ["", "", "", "5", "", "1", "4", "8", "2"]]"

I need to remove quotation mark (") before the board word in the DO It Result above. Let me know if you need any further info.

When I compared your Do It results against your blocks, I see a contradiction.
Your Do It is against a text JOIN block.

I ran a quick experiment to see if Do It on a text value (from JOIN) would add quotes:
Capture
As you can see from my experiment, there are no quotes around my JOIN result ab.

Please double check that you are showing me the result of a Do It against a JOIN block.
If so, please give me the means to reproduce that effect.
It's very fishy.

This is rather maddening.
I blame Do It.

It is aggravating to have a tool that adds metacharacters sometimes, and none other times.

The quote at the front of the Do It result is probably not in the underlying string, just in the bubble text. You can verify that using the segment experiment I have shown.

Regarding your original problem, of how to build a precisely formatted string from a particular structure, I advise coding a custom value procedure instead of relying on off-the-rack default list and table coercion. Loop through your rows and columns using for each number loops (you need the index for special end cases), and build up your string using JOINs. That will give you complete control.

Hi ABG,

Please see some snippets from the logic board which i have used.

First screen shot, I am making a list but I am getting double quotes around each value. Please refer Do It in the next screen shot.
In the third screen shot, please see that double quotes before board word.

I am little new so I am sorry that i didn't understand your previous explanation of making a customer procedure. Unfortunately, my API is looking for formatted string and hence I am facing this problem.

Show me your API requirements.
I can't code to meet a moving target.

Post your exported .aia file so we can see how the API responds.

Hi ABG,

Please find attached the AIA file for my project.
Below is the success request for my project for the validate request.
Please let me know if you require any other details.
Thanks

DailyDose2_copy.aia (2.3 MB)

Further details of API are provided on the following site.

My Javascript is weak, so I am going to treat the web site like a black box.

  • What tool are you using to show web requests and responses? It looks very useful. For example, it shows how your puzzle submission is rejected possibly because row 1 only has 8 items instead of the mandatory 9 items. If you were to show me a request that elicits a response other than "{status":"broken"} it would give me the confidence to proceed further on the app side.

  • I notice you are sending Web3 your request headers in a dictionary. The tooltip for that block asks for a list of lists. I suggest this (draggable) replacement ...


    (the PostText block rode along by accident. Its inclusion in this image is not an endorsement of it.)

  • I did not see any place in the Github docs where they ask for board= in the URI. However, I did see places where they mention URIEncoding the text.

  • In case you are interested in reducing the block count and complexity of this project,
    I suggest using generic blocks, keeping components in a table by row & column, and looping over the rows and columns in your initialization and transcription phases.

  • The way you are building a board table is additive. That leads to overly long rows. You would benefit from value functions that return tables of values, formatted or unformatted depending on the destination.

  • Sample projects:
    https://docs.google.com/document/d/1Ctf-tI-oRaoziGqb-V-h9ATAtVhCPvHY65EoVW-FpZA/edit?usp=sharing
    https://github.com/AGetzler/eight_queens_generic