I know how to connect to Infusionsoft with Python 3 and how to process the following simple example:
#Set up the contact data we want to add
contact = {}; #blank dictionary
contact[“FirstName”] = “John”;
contact[“LastName”] = “Doe”;
contact[“Email”] = "john#doe.com";
contact[“Company”] = “ACME”;
But how do I mass update the WHOLE database? e.g. If I want to update ALL The Phone1 fields with an extra bit of code using IF statements.
Using Infusionsoft API you can only update contacts data one by one, sending a separate request per contact. Exact request depends on which type of API you use: REST or XML-RPC
Related
Need to search multiple product codes using using SolrSearchQueryTemplate so that we can get all products in a single solr call
I am able to search one product code at a time using SolrSearchQueryTemplate but not sure how shall modify solr query so that i can pass multiple product codes in solr request
please find below implementation i have done to search single product code using SolrSearchQueryTemplate and it works fine
$productType=testProductType
$ftsQueryBuilder=multiFieldFreeTextQueryBuilder
INSERT_UPDATE SolrSearchQueryTemplate;name[unique=true];ftsQueryBuilder[default=$ftsQueryBuilder];showFacets;restrictFieldsInResponse;indexedType(Identifier)[default=$productType]
;TESTTEMPLATE;;false;true;
INSERT_UPDATE SolrSearchQueryProperty;ftsQuery;indexedProperty(name)[unique=true];searchQueryTemplate(name)[unique=true]
;true;code;TESTTEMPLATE
final PageableData pageableData = createPageableData(0, getSearchPageSize(), null, ShowMode.Page);
final SearchStateData searchState = new SearchStateData();
final SearchQueryData searchQueryData = new SearchQueryData();
searchQueryData.setValue(XSSFilterUtil.filter(prodIdentifier.get(0)));
searchQueryData.setSearchQueryContext(SearchQueryContext.THIRDPARTYINTEGRATION);
searchState.setQuery(searchQueryData);
pageableData.setFlow(MyConstants.THIRDPARTYINTEGRATION);
final ProductSearchPageData<SearchStateData, de.hybris.platform.commercefacades.product.data.ProductData> searchPageData = testCloudProductSearchFacade
.getProductByCodeMafIdBrand(searchState, pageableData, MyConstants.THIRDPARTYINTEGRATION);
List<ProductData> prodFromSolr = searchPageData.getResults();
let me know what modifications are required to be done in this so that i can pass multiple product codes in request
Note:
searchQueryData.setValue(XSSFilterUtil.filter(prodIdentifier.get(0)));
setValue method accepts single parameter of type String
is it possible to send multiple codes separated by some token which SolrSearchQueryTemplate will automatically consider as multiple search terms
Is it possible to fetch data using StackAPI using UserID instead of "fromdate" or "questionID" etc?
I want to fetch the questions and tags used by a particular user.
What's the syntax for it.
I have tried
from stackapi import StackAPI
SITE = StackAPI('stackoverflow')
SITE._api_key = None
associated_users = SITE.fetch('/users/{}/associated'.format(10286273),
pagesize=1)
associated_users
But I don't know how to print data from it.
I don't see how "associated" is relevant to your stated goal.
You are interested in queries like:
tags = SITE.fetch('/users/{}/tags'.format(10286273), site='stackoverflow')
questions = SITE.fetch('/users/{}/questions'.format(10286273), site='stackoverflow')
which retrieve details on seven posts,
mentioning tags like python and chatbot.
cf https://api.stackexchange.com/docs/questions-by-ids
I'm using xero-node npm package & looks like it will save me a ton of time.
I want to create OR update multiple contacts but not sure how. I'm hoping someone from Xero monitors this tag.
var contacts = [];
var contact = { "Name": "ABC", ContactNumber:"code123"};
contacts.push(xeroClient.core.contacts.newContact(contact));
const retVal = await xeroClient.core.contacts.saveContacts(contacts);
If I run it once , it creates the contact ( or multiple if I add to the array ) . I want to update the contact using my code ( not the xero generated id - because then I would need to store that it my other system).
If I run it a second time , it fails. I assume that is because it is doing a PUT instead of a POST..?
Here are the docs.
https://github.com/XeroAPI/xero-node/blob/2a1ec34888e998cabd72aa79fa58a5b14f2c9cd5/docs/Contacts.md
You are correct.
Here are the docs on Contacts:
https://developer.xero.com/documentation/api/contacts
See this section:
PUT Contacts
Use this method to create one or more contact records. This method works very similar to POST Contacts but if an existing contact matches your ContactName or ContactNumber then you will receive an error.
ContactNumber is unique. So you're trying to create two contacts with the same ContactNumber.
I think saving the contact like in the example here would help: https://github.com/XeroAPI/xero-node/blob/2a1ec34888e998cabd72aa79fa58a5b14f2c9cd5/docs/Contacts.md
I need to get data from API which url based on different ID.
url = "http://123456789/"
id = "jimmy"
I have a list of ID, here are my code
for id in ID:
response = requests.get(url+id)
info = response.json(encoding = "utf-8")
##save info
But I have 400,000 ID and it will take to long to grab all data,
So I want use multiprocess to finish this job.
Cut the ID list into 10 or more small list and run them in the same time.
How can I do that?
Please help, thanks!
You can use Pool.
Cut the list of IDs into many subIds, and different process handle different ids.
https://docs.python.org/2/library/multiprocessing.html
Does getstream provide a way to retrieve the number of activities within a feed? I have a notification feed setup. I can retrieve the activities using paginated get. However, I would like to display the number of items within the feed.
Unfortunately not, there is no API endpoint to retrieve the amount of activities within a feed.
At the moment there's no way to count activities directly. You can try
Use a custom feed and use reactions. So now you call count from reactions.
Other way is store in your app (cache/db/etc).
It worked for me:
signature = Stream::Signer.create_jwt_token('activities', '*', '<your_secret>', '*')
uri = URI("https://us-east-api.stream-io-api.com/api/v1.0/enrich/activities/?api_key=<api_key>&ids=<id1,id2,...>&withReactionCounts=true")
req = Net::HTTP::Get.new(uri)
req['Content-Type'] = "application/json"
req['Stream-Auth-Type'] = "jwt"
req['Authorization'] = signature
res = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) {|http|
http.request(req)
}
puts JSON.parse(res.body)
References:
Retrieve
reactions_read-feeds
activities
ruby client
Update 2022
You can only get the number of activities in groups within aggregated or notification feeds. Flat feeds are still not supported.
Source
The best solution is to store important numbers in the database which Stream provides.
Source