Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Setup a custom Post call to Rest API using Atteryx

ssripat3
8 - Asteroid

Hello Alteryx community,

 

I am currently in the process of passing a call to an API. Some of the data for this call is present in a column in Alteryx which would be a set of numbers in rows within a Part Number column whose datatype is a "V_String". Please find the example table and API call below.

 

Sample Table

 

Part NumberPart NamePart Available
12345678ANUTY
14567890ABOLTN
98765432AENGINEN
32109876ACHASSISY

 

Sample API Call/Request

 

{
    "companyCode""TST01",
    "partNumbers": [
        {
            partNumber""12345678A"
        },
        {
            "partNumber""14567890A"
        },
        {
            "partNumber""98765432A"
        },
        {
            "partNumber""32109876A"
        }
    ]
}
 
Can anyone please help me on how to achieve this? I tried to use "Report Text" feature in documentation, but that seems to be somewhat rather an hassle and I wasn't able to achieve it. If possible, is there a way where we could run a Multi-Row formula and generate the API request and create a new Column with the complete request in one single row or whatever the best possible way to solve this scenario.
 
Thank you,
Sachit
4 REPLIES 4
apathetichell
18 - Pollux

use transpose. Then build a Json pair using name/value. Use summarize tool to build this into one payload. Use download tool for your api.

ssripat3
8 - Asteroid

Just one other small help if possible. I am trying to use Regex to Parse through JSON_Name column and get particular values which match the criteria.

 

JSON_NameJSON_Name_After_Regex_Parse
result.Parts.0.mfgPart.partPrefixpartPrefix
result.Parts.0.mfgPart.partBasepartBase
result.Parts.0.mfgPart.partSuffixpartSuffix
result.partnerParts.0.partnerPartNumberpartnerPartNumber
result.partnerParts.0.partnerPartNamepartnerPartName
result.partnerParts.0.partnerPartCompanyNamepartnerPartCompanyName

 

Can anyone please help on how to achieve this?

 

I referred this article. But those methods didn't work for me as I was unable to specify "." as a character in the Regex.

 

Solved: Regex extracting after last underscore - Alteryx Community

Luke_C
17 - Castor

Hi @ssripat3 

 

This should work. In regex a period is typically used to reference a character. In order to literally specify a period you need to prefix it with a slash (escape character). 

 

 

.*\.(.*)

 

 

Luke_C_0-1660081518784.png

 

apathetichell
18 - Pollux

I used regex_replace([JSON_Name],"(\w+\.\d+\.)(\w+.*)$","$2") recently which should get you what you need. if you want the number to use in crosstabbing you could do:

 

([JSON_Name],"(\w+\.)(\d+)(\.)(\w+.*)$","$2") - to get the record number and

 

([JSON_Name],"(\w+\.)(\d+)(\.)(\w+.*)$","$4") - to get the JSON name

 

this assumes there are no non-word characters in any field names which worked in my case.

 

Labels