- Joined
- Oct 14, 2022
- Messages
- 6
- Reaction score
- 1
Hello,
I am using trying to integrate my 3cx to query the orders for a customer who is calling. I am having an issue with id not being recognized. since I am executing a search on native woo commerce rest api endpoint the response is as follows. The API can return multiple orders for the same person so here is an example response with most of the information removed except for id. I am trying to map the id but it is failing. I have tried [0].id 0.id but does not work.
[
{
"id": 7353,
"parent_id": 0,
"status": "completed",
"currency": "USD",
"version": "6.9.4",
"prices_include_tax": false,
}
{ <another order> }
{ <another order> }
]
Here is the scenario xml code
<Scenario Id="" Type="REST">
<Request Url="https://example.com/wp-json/wc/v3/orders?search=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
<Rules>
<Rule Type="Any">0.id</Rule>
</Rules>
<Variables>
<Variable Name="ContactID" Path="0.id">
<Filter />
</Variable>
<Variable Name="FirstName" Path="0.billing.first_name">
<Filter />
</Variable>
<Variable Name="LastName" Path="0.billing.last_name">
<Filter />
</Variable>
<Variable Name="Email" Path="0.billing.email">
<Filter />
</Variable>
<Variable Name="PhoneMobile" Path="0.billing.phone">
<Filter />
</Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="ContactID" Passes="0" Value="[ContactID]" />
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="Email" Passes="0" Value="" />
<Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
<Output Type="ContactUrl" Passes="0" Value="https://example.com/wp-admin/post.php?post=[ContactID]&action=edit" />
<Output Type="EntityId" Passes="0" Value="[ContactID]" />
<Output Type="EntityType" Passes="0" Value="Contacts" />
</Outputs>
</Scenario>
Here is the response from the log
Started scenario with empty id
Request text: https://example.com/wp-json/wc/v3/orders?search=855264
Response text: [{"id":7353,"parent_id":0,"status":"completed",
I am using trying to integrate my 3cx to query the orders for a customer who is calling. I am having an issue with id not being recognized. since I am executing a search on native woo commerce rest api endpoint the response is as follows. The API can return multiple orders for the same person so here is an example response with most of the information removed except for id. I am trying to map the id but it is failing. I have tried [0].id 0.id but does not work.
[
{
"id": 7353,
"parent_id": 0,
"status": "completed",
"currency": "USD",
"version": "6.9.4",
"prices_include_tax": false,
}
{ <another order> }
{ <another order> }
]
Here is the scenario xml code
<Scenario Id="" Type="REST">
<Request Url="https://example.com/wp-json/wc/v3/orders?search=[Number]" MessagePasses="0" RequestEncoding="UrlEncoded" RequestType="Get" ResponseType="Json" />
<Rules>
<Rule Type="Any">0.id</Rule>
</Rules>
<Variables>
<Variable Name="ContactID" Path="0.id">
<Filter />
</Variable>
<Variable Name="FirstName" Path="0.billing.first_name">
<Filter />
</Variable>
<Variable Name="LastName" Path="0.billing.last_name">
<Filter />
</Variable>
<Variable Name="Email" Path="0.billing.email">
<Filter />
</Variable>
<Variable Name="PhoneMobile" Path="0.billing.phone">
<Filter />
</Variable>
</Variables>
<Outputs AllowEmpty="false">
<Output Type="ContactID" Passes="0" Value="[ContactID]" />
<Output Type="FirstName" Passes="0" Value="[FirstName]" />
<Output Type="LastName" Passes="0" Value="[LastName]" />
<Output Type="Email" Passes="0" Value="" />
<Output Type="PhoneMobile" Passes="0" Value="[PhoneMobile]" />
<Output Type="ContactUrl" Passes="0" Value="https://example.com/wp-admin/post.php?post=[ContactID]&action=edit" />
<Output Type="EntityId" Passes="0" Value="[ContactID]" />
<Output Type="EntityType" Passes="0" Value="Contacts" />
</Outputs>
</Scenario>
Here is the response from the log
Started scenario with empty id
Request text: https://example.com/wp-json/wc/v3/orders?search=855264
Response text: [{"id":7353,"parent_id":0,"status":"completed",