Free busy query caldav for iCloud - icloud

URL -: https://pxx-caldav.icloud.com/token/calendars/
Content type -: application/xml; charset=utf-8
Headers -: {Depth: 1}
Method -: REPORT
Request content -: <?xml version='1.0' encoding='utf-8' ?>
<C:free-busy-query xmlns:C='urn:ietf:params:xml:ns:caldav'>
<C:time-range start = '20171104T120000Z' end='20171113T120000Z'/>
</C:free-busy-query>
Here, I am trying to fetch free/busy info using free-busy-query but server gives (500) Internal Server Error. When I have fetched calendars it shows ready/free busy access and supported report set has free-busy-query for calendar. I am missing something or iCloud doesn't support free/busy query?

Unless I am mistaken, you are querying the calendar home (https://pxx-caldav.icloud.com/token/calendars/) and not individual calendars.
As per https://www.rfc-editor.org/rfc/rfc4791#section-7.2 , it is not mandatory for servers to support fb queries on calendar home. Of course returning a 500 does not seem like the right response.
Now if what you want to do is to query the overall availability of the user, you should use instead the CalDAV Scheduling freebusy query. See https://www.rfc-editor.org/rfc/rfc6638#section-5

Related

Create Category using moodle api call from postman error

I am trying to create a category in moodle making api call from postman
API Endpoint: http://localhost/MyMoodle/webservice/rest/server.php
Method: POST
Payload: Selected x-www-form-urlencoded
wstoken:<token>
wsfunction:core_course_create_categories
moodlewsrestfomat:json
categories[0][name]:Custom Cat 1
categories[0][parent]:0
categories[0][idnumber]:1
categories[0][description]:CustomCatdescription
getting below error
<?xml version="1.0" encoding="UTF-8" ?>
<EXCEPTION class="invalid_parameter_exception">
<ERRORCODE>invalidparameter</ERRORCODE>
<MESSAGE>Invalid parameter value detected</MESSAGE>
</EXCEPTION>
Based on the error and the test parameters, I'd guess it's one of these issues:
Postman isn't encoding the spaces, and Moodle doesn't like that. Try replacing the spaces in your category name with %20
The idnumber is not unique. Check that a category with that idnumber doesn't already exist.
Also, I just wanted to note that you can also test the Moodle API directly in your browser. This can be a good way to make sure there's not an issue with any of your credentials or permissions. Just navigate to a url like this:
http://localhost/MyMoodle/webservice/rest/server.php?moodlewsrestformat=json&wstoken=<token>&wsfunction=core_course_create_categories&categories[0][name]=Custom%20Cat%201&categories[0][parent]=0&categories[0][idnumber]=1&categories[0][description]=CustomCatdescription

Amazon sp-api incorrect URL encoding / decoding characters while updating quantity

I have an issue when including the special characters such as "#" in Amazon Listing API. For example, the sku, HP-2DP98AA#ABC-200621 will be updating the quantity at 20. However, Amazon API responses InvalidSignature
I did apply the encoding for the SKU before submitting the request to Amazon, but it is failed all the time. Any idea?
the AWS documents selling-partner-api-docs Rest API about how to patch the items URL is PATCH /listings/2020-09-01/items/{sellerId}/{sku}. This means that sku need to add in URL which contains "#" like this.
/listings/2020-09-01/items/{your sellerId}/HP-2DP98AA#ABC-200621
This request URL would be cause the exception or InvalidSignature from AWS , because "#" in URL need to encode "#" to "%23" such as below:
/listings/2020-09-01/items/{your sellerId}/HP-2DP98AA%23ABC-200621
Also, need to add sellerId, marketplaceIds, and sku parameters as well.
Additionally, AWS4 Canonical Request is like below:
AWS4 Canonical Request: '"PATCH
/listings/2020-09-01/items/{your sellerId}/HP-2DP98AA%2523ABC-200621
marketplaceIds={your marketplaceIds}&sellerId={your sellerId}&sku=HP-2DP98AA%23ABC-200621
content-type:application/json; charset=utf-8
host:sellingpartnerapi-na.amazon.com
x-amz-access-token:Atza|...
x-amz-date:20210831T190152Z
x-amz-security-token:Fwo...
content-type;host;x-amz-access-token;x-amz-date;x-amz-security-token
d1809d68......"

Amazon Listing Data Import

I am trying to import the product titles and review ratings from a listing to a Google Spreadsheet. I have tried the ImportXML fuction using Xpath query but that does not work. So, I tried a code as mentioned below and it worked. I have been able to get the listing data but sometimes it gives me an error instead of displaying the data.
Error:
Request failed for https://www.amazon.co.uk returned code 503. Truncated server response: For information about migrating to ... (use muteHttpExceptions option to examine full response). (line 2).
When I refresh the code or when I add/remove https:// from the url, it works again but when I refresh the sheet, it goes off sometime and displays the error.
Question:
Is there any way to get rid of the error?
While trying to get the Star Rating displayed on the sheet, it uses a Span Data-hook class where the data is stored and I am unable to retrieve it. Is there any way to retrieve the star rating as well?
This is the function that I have created to get the product title and other data:
function productTitle(url) {
var content = UrlFetchApp.fetch(url).getContentText();
var match = content.match(/<span id="productTitle".*>([^<]*)<\/span>/);
return match && match [1] ? match[1] : 'Title not found';
}
You are receiving HTTP Status codes of 503, that means the service you are trying to reach is either under maintenance or overloaded.
This is on Amazon's side. You should use the Amazon API instead of the public endpoints for processing this data.

Instagram Graph API - Fetch media insights metric when a user switched from personal to business account

I'm looking for a way to fetch Media Insights metrics in Instagram Graph API (https://developers.facebook.com/docs/instagram-api/reference/media/insights) with a nested query based on the userId, even when a client switched from a Personal to a Business account.
I use this nested query to fetch all the data I need : https://graph.facebook.com/v3.2/{userId}?fields=followers_count,media{media_type,caption,timestamp,like_count,insights.metric(reach, impressions)} (this part causes the error: insights.metric(reach, impressions) - it works however for an account that has always been a Business one)
However, because some media linked to the userId were posted before the user switched to a Business account, instead of returning the data only for the media posted after, the API returns this error:
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_data": {
"blame_field_specs": [
[
""
]
]
},
"error_subcode": 2108006,
"is_transient": false,
"error_user_title": "Media Posted Before Business Account Conversion",
"error_user_msg": "The media was posted before the most recent time that the user's account was converted to a business account from a personal account.",
"fbtrace_id": "Gs85pUz14JC"
}
}
Is there a way to know, thru the API, which media were created before and after the account switch from Personal to Business? Or is there a way to fetch the date on which the account was switched?
The only way I currently see to get the data I need is to use the /media edge and query insights for each media until I get an error. Then I would get approximately the date I need. However, this is not optimized at all since we are rate limited to 200 calls per user per hour.
I have the same problem.
For now, I'm Switch between queries (if first have error)
"userId"?fields=id,media.limit(100){insights.metric(reach, impressions)}
"userId"?fields=id,media.limit(100)
I show the user all insights in zero.
I don't know if they're the best alternative, like identify the time of conversion to business and get the post between this range of DateTime
I got the same problem and solved it like this:
Use the nested query just like you did, including insights.metric
If the error appears, do another call without insights.metric - to at least get all other data
For most accounts, it works and there is no additional API call. For the rest, i just cannot get the insights and i have to live with it, i guess - until Facebook/IG fixes the issue.
I got the same problem and solved it like this:
Step1: Convert your Instagram account to a Professional account.
Step2: Then According to Error Post a new post on Instagram and get their Post-ID.
Step3: Then try to get a request using that Post-ID.
{Post-ID}?fields=comments_count,like_count,timestamp,insights.metric(reach,impressions)
curl -i -X GET "https://graph.facebook.com/v12.0/{Post-ID}?fields=comments_count%2Clike_count%2Ctimestamp%2Cinsights.metric(reach%2Cimpressions)&access_token={access_token}"
For more: insights
Here is the relevant logic from a script that can handle this error while still doing a full import. It works by reducing the requested limit to 1 once the error is encountered. It will keep requesting insights until it encounters the error again, then removes insights from the fields and returns to the requested limit.
limit = 50
error_2108006 = False
metrics = 'insights.metric%28impressions%29%2C' # Must be URL encoded for replacement
url = '/PAGE_ID/media?fields=%sid,caption,media_url,media_type&limit=%s' % (metrics, limit)
# While we have more pages
while True:
# Make your API call to Instagram
posts = get_posts_from_instagram(url)
# Check for error 2108006
if posts == 2108006:
# First time getting this error, keep trying to get insights but one by one
if error_2108006 is False:
error_2108006 = True
url = url.replace('limit={}'.format(limit), 'limit=1')
continue
# Not the first time. Strip out insights and return to desired limit.
url = url.replace(metrics, '')
url = url.replace('limit=1', 'limit='.format(limit))
continue
# Do something with the data
for post in posts:
continue
# If there are more pages, fetch the next URL
if 'paging' in posts and 'next' in posts['paging']:
url = posts['paging']['next']
continue
# Done
break

How to fetch a tag value from Test step response file (REST request's response) in SOAP UI

I am a newbie to SOAP UI, I need to fetch a tag value from Test step response file (REST request's response) and set it as testsuite property.
My Request file looks like;
<xdata created_by="XXXX" created_at="Wed Mar 16 08:45:39 EDT 2016" app="" profile="" app_version="" env="DEV" tran="" service="1234">
<rows start_index="0">
<row basketId="1234566" basketVersionId="11" basketName="ORDERS_1505" basketDescription="ORDERS" createdUserName="XXXX" updatedUserName="XXX" __errorMsg="{"errors":[],"success":true}" totalApprovedOrderCount="0"/>
</rows>
</xdata>
I need to fetch basketVersionId attribute, please help.
Note: All the examples I read are dealing with Soap Response, property transfer using namespace and xpath. but that is not woking here I guess.
SOAPUI converts practically all to Xml, so despite the fact that you've a REST service you can use anyway and XPath in the property transfer testStep.
The only difference is that in property transfer you've to select:
ResponseAsXml as a property for the REST service with a Json response.
Response as a property for a SOAP service with Xml response.
So you can use: //*:row/#basketVersionId as XPath to get your attribute value.
Hope it helps,