Hello friends,
How to include hbCurl? Is it working in xHarbour, too?
Best regards,
Otto
c:\curl-8.6.0_3-win64-mingw\bin\curl.exe -u username:password -k -F "fileToUpload=@c:\xxxx\tmpplan\planangebot.dbf" https://test.com/webservices/responderdbf.php
Otto wrote:Hello friends,
How to include hbCurl? Is it working in xHarbour, too?
Best regards,
Otto
TimStone wrote:Otto,
I include, in a .mak file, the following:
echo $(HBDIR)\lib\hbtipssl.lib >> msvc.tmp
echo $(HBDIR)\lib\hbcurl.lib >> msvc.tmp
echo $(HBDIR)\lib\libcurl.lib >> msvc.tmp
I do my builds with Harbor and MSVC
It works fine. Also include the libcurl.dll
It also works for 64 bit with those libraries and the 64 bit dll
Tim
It seems like you're trying to add tags to a member in a MailChimp list using the MailChimp API and curl in a command line environment. The issue appears to be with the way you're formatting the JSON data in your curl command. Let's break down the correct format and structure for your curl command to add tags to a member.
Here's the general format you need to follow based on Mailchimp's documentation:
```bash
curl -X POST \
https://${dc}.api.mailchimp.com/3.0/lists/{list_id}/members/{subscriber_hash}/tags \
--user "anystring:${apikey}" \
-d '{"tags": [{"name": "tagName", "status": "active"}], "is_syncing": false}'
```
Now, applying this format to your specific case, the command should look something like this:
```bash
DCOM := 'cmd /c curl -X POST https://us8.api.mailchimp.com/3.0/lists/' + cListID + '/members/' + cSecure_Email + '/tags --user "anystring:' + cApi + '" -d "{""tags"": [{""name"": ""' + aTags + '"", ""status"": ""active""}], ""is_syncing"": false}" > clogrooms.txt'
```
In this command, `cListID` should be replaced with your MailChimp list ID, `cSecure_Email` should be the subscriber's hashed email address, `cApi` is your API key, and `aTags` is the tag name you want to add. Note that we need to escape double quotes inside the JSON data by using `""`.
Make sure that `aTags` is properly formatted. If `aTags` is a variable containing the tag name, ensure that it doesn't have spaces or special characters that might break the JSON format.
If you have multiple tags to add, you would expand the `tags` array like so:
```json
"tags": [{"name": "tagName1", "status": "active"}, {"name": "tagName2", "status": "active"}]
```
Lastly, ensure that the email address is correctly hashed as per Mailchimp's requirements (using MD5 and in lowercase) when replacing `cSecure_Email`. If there are still issues, double-check the JSON payload for correct formatting and ensure that all required fields are provided accurately.
*** Hard coded test tag)
cTagName := "tag1" // De naam van de tag
cTagStatus := "active" // De status van de tag
*** Constructie JSON-payload met de enkele tag
cJsonPayload := '"tags": { "name": "' + cTagName + '", "status": "' + cTagStatus + '" } , "is_syncing": false '
msginfo(cJsonPayload)
DCOM := 'cmd /c curl -sS https://us8.api.mailchimp.com/3.0/lists/' + cLists + '/members/' + cSecure_Email + '/tags --user anystring:' + cApi + ' -d ' + CHR(34) + cJsonPayload + CHR(34) + ' > clogrooms.txt'
cresponse := "["
cresponse += "{" + '"name":' + '"' + 'name default' + '",'
cresponse += '"CurlPath":' + '"' + h['CurlPath'] + '",'
cresponse += '"test":' + '"' + 'test' + '" },'
cresponse := left( cresponse , len( cresponse )-1 ) + "]"
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Marc Venken and 63 guests