Strapi filtering localization with images - api

I think problem may be in how I compose the request for API?
According to strapi documentation strapi docs there is possible to filter data by using following syntax. GET /api/:pluralApiId?filters[field][operator]=value
example:
Example request: Find users having 'John' as first name
So my goal is get images and text for specific localization for my collection AboutBox which contains 3 text fields and 1 media type. My request look like this: api/about-boxes?populate=*&?filters[locale][$eq]=en
What return request look like:
{
"data": [
{
"id": 1,
"attributes": {
"title": "About us",
"createdAt": "2023-02-08T07:47:38.543Z",
"updatedAt": "2023-02-09T08:49:40.543Z",
"publishedAt": "2023-02-08T07:48:48.681Z",
"locale": "en",
"text": "At CGI we provide a wide range of services and solutions that significantly help our clients grow financially and technologically. Our CGI CZ Space team focuses on the use of satellite data for remote scanning of the Earth tailored to all our customers across sectors. We deliver projects to the European Space Agency (ESA), participate in the development and support of the Galileo navigation system and more.",
"buttonText": "Check it out",
"logo": {
"data": {
"id": 3,
"attributes": {
"name": "cgi_logo.svg",
"alternativeText": "cgi_logo",
"caption": null,
"width": 59,
"height": 27,
"formats": null,
"hash": "cgi_logo_934146d58f",
"ext": ".svg",
"mime": "image/svg+xml",
"size": 0.98,
"url": "/uploads/cgi_logo_934146d58f.svg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-08T07:46:17.180Z",
"updatedAt": "2023-02-08T07:48:31.102Z"
}
}
},
"localizations": {
"data": [
{
"id": 2,
"attributes": {
"title": "O nás",
"createdAt": "2023-02-08T07:47:50.849Z",
"updatedAt": "2023-02-10T14:04:21.010Z",
"publishedAt": "2023-02-10T14:04:20.963Z",
"locale": "cs",
"text": "Ve společnosti CGI poskytujeme širokou škálu služeb a řešení, která našim klientům významně pomáhají finančně a technologicky růst. Náš tým CGI CZ Space se zaměřuje na využití družicových dat pro dálkové snímkování Země na míru všem našim zákazníkům napříč odvětvími. Dodáváme projekty pro Evropskou kosmickou agenturu (ESA), podílíme se na vývoji a podpoře navigačního systému Galileo a dalších.",
"buttonText": "Podívejte se na to"
}
}
]
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 1
}
}
}
What I am expecting is get only data where is: "locale": "en",
not the one where is "locale": "cs",
basically without this block
"localizations": {
"data": [
{
"id": 2,
"attributes": {
"title": "O nás",
"createdAt": "2023-02-08T07:47:50.849Z",
"updatedAt": "2023-02-10T14:04:21.010Z",
"publishedAt": "2023-02-10T14:04:20.963Z",
"locale": "cs",
"text": "Ve společnosti CGI poskytujeme širokou škálu služeb a řešení, která našim klientům významně pomáhají finančně a technologicky růst. Náš tým CGI CZ Space se zaměřuje na využití družicových dat pro dálkové snímkování Země na míru všem našim zákazníkům napříč odvětvími. Dodáváme projekty pro Evropskou kosmickou agenturu (ESA), podílíme se na vývoji a podpoře navigačního systému Galileo a dalších.",
"buttonText": "Podívejte se na to"
}
}
]
}
Also for unknow reason when I get request for czech localization I did not get data in return:
czech request return
Any help would be appreciated

According to Strapi docs you can receive localized entries via GET /api/{content-type}?locale={locale-code}

Related

Microsoft Booking Appointment Graph API -Only Post Request Not working

when I trying to create Microsoft Booking Appointment through Graph API
Only Post Request Not working .
GET , PATCH , DELETE Reuqest are working fine
through postman
same post request is working find on graph explorer platform . but not on posmant with
my auth token
my post API
https://graph.microsoft.com/v1.0/solutions/bookingBusinesses/XXXXXXXXXXXXXXX.com/appointments
and body (took example from here)
excluded optional properties like servicename and customers
{
"#odata.type": "#microsoft.graph.bookingAppointment",
"customerTimeZone": "America/Chicago",
"smsNotificationsEnabled": false,
"endDateTime": {
"#odata.type": "#microsoft.graph.dateTimeTimeZone",
"dateTime": "2023-01-02T14:30:00.0000000",
"timeZone": "UTC"
},
"isLocationOnline": true,
"optOutOfCustomerEmail": false,
"anonymousJoinWebUrl": null,
"postBuffer": "PT10M",
"preBuffer": "PT5M",
"price": 10,
"priceType#odata.type": "#microsoft.graph.bookingPriceType",
"priceType": "fixedPrice",
"reminders#odata.type": "#Collection(microsoft.graph.bookingReminder)",
"reminders": [
{
"#odata.type": "#microsoft.graph.bookingReminder",
"message": "This service is tomorrow",
"offset": "P1D",
"recipients#odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "allAttendees"
},
{
"#odata.type": "#microsoft.graph.bookingReminder",
"message": "Please be available to enjoy your lunch service.",
"offset": "PT1H",
"recipients#odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "customer"
},
{
"#odata.type": "#microsoft.graph.bookingReminder",
"message": "Please check traffic for next cater.",
"offset": "PT2H",
"recipients#odata.type": "#microsoft.graph.bookingReminderRecipients",
"recipients": "staff"
}
],
"serviceId": "XXXXXXXXXXXXXXXXXXXXX",
"serviceLocation": {
"#odata.type": "#microsoft.graph.location",
"address": {
"#odata.type": "#microsoft.graph.physicalAddress",
"city": "Buffalo",
"countryOrRegion": "USA",
"postalCode": "98052",
"postOfficeBox": null,
"state": "NY",
"street": "123 First Avenue",
"type#odata.type": "#microsoft.graph.physicalAddressType",
"type": null
},
"coordinates": null,
"displayName": "Customer location",
"locationEmailAddress": null,
"locationType#odata.type": "#microsoft.graph.locationType",
"locationType": null,
"locationUri": null,
"uniqueId": null,
"uniqueIdType#odata.type": "#microsoft.graph.locationUniqueIdType",
"uniqueIdType": null
},
"serviceNotes": "Customer requires punctual service.",
"startDateTime": {
"#odata.type": "#microsoft.graph.dateTimeTimeZone",
"dateTime": "2023-01-02T14:00:00.0000000",
"timeZone": "UTC"
},
"maximumAttendeesCount": 1,
"filledAttendeesCount": 1
}

Sandbox access token not working [Easyship]

We have to try to integrate Easyship courier API. And We are facing the below issue.
{
"rates": [],
"messages": [
"Sorry, we couldn't find any shipping solutions based on the information provided."
]
}
For more information, I have shared the request parameter and API response.
API URL:- https://api.easyship.com/v2/rates
Request Parameter:
{
"origin_address": {
"postal_code": "91601",
"city": "Los Ángeles",
"state": "CA",
"country_alpha2": "US"
},
"destination_address": {
"postal_code": "95140",
"city": "Mount Hamilton",
"state": "CA",
"country_alpha2": "US"
},
"parcels": [
{
"total_actual_weight": 5,
"items": [
{
"quantity": 1,
"category": "mobile_phones",
"dimensions": {
"width": 10,
"height": 10,
"length": 25
},
"description": "Apple iPad",
"actual_weight": 5,
"declared_currency": "USD",
"declared_customs_value": 49500.55
}
]
}
]
}
Response Parameter:
{
"status": "failure",
"errors": [
"Sorry, we couldn't find any shipping solutions based on the information provided."
],
"request_id": "545b5f76a41e2994a13f384559dee625",
"timestamp": "2022-10-12T10:09:21.272Z"
}
Note:
This request parameter works with the production access token.
We have applied all possible solutions for this issue but didn't find anything.
Also we don't want to use the production access token because we are in the developing stage. so please please provide working with a sandbox solution.

How to get the admin/creator of a repository using Github REST API v3

I want to get the details of the person who created the repository using Github API. I got the repositories in my organization using:
https://github.example.com/api/v3/search/repositories?q=org:<name>
I got a list of 30 repositories within the organization with details in the following manner:
{
"total_count": 40,
"incomplete_results": false,
"items": [
{
"id": 3081286,
"node_id": "MDEwOlJlcG9zaXRvcnkzMDgxMjg2",
"name": "Tetris",
"full_name": "dtrupenn/Tetris",
"owner": {
"login": "dtrupenn",
"id": 872147,
"node_id": "MDQ6VXNlcjg3MjE0Nw==",
"avatar_url": "https://secure.gravatar.com/avatar/e7956084e75f239de85d3a31bc172ace?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
"gravatar_id": "",
"url": "https://api.github.com/users/dtrupenn",
"received_events_url": "https://api.github.com/users/dtrupenn/received_events",
"type": "User"
},
"private": false,
"html_url": "https://github.com/dtrupenn/Tetris",
"description": "A C implementation of Tetris using Pennsim through LC4",
"fork": false,
"url": "https://api.github.com/repos/dtrupenn/Tetris",
"created_at": "2012-01-01T00:31:50Z",
"updated_at": "2013-01-05T17:58:47Z",
"pushed_at": "2012-01-01T00:37:02Z",
"homepage": "",
"size": 524,
"stargazers_count": 1,
"watchers_count": 1,
"language": "Assembly",
"forks_count": 0,
"open_issues_count": 0,
"master_branch": "master",
"default_branch": "master",
"score": 10.309712
}
]
}
The problem I have right now is that the owner's id is always the same and it's equal to the organization name. I want the details of the creators. Is there any way I could do that? I tried searching everywhere, but I couldn't find any solution.

Location based pricing in Softlayer via API

The script in the following link provides location based pricing for each item:
http://sldn.softlayer.com/blog/cmporter/location-based-pricing-and-you
When I run above script for example for Toronto location, the returned value does not match the pricing in the SL portal for Toronto. For example, the script returns 8GB # 0.085/hr vs pricing from portal which is 0.090 for 8GB in Tor:
"864": {
"capacity": "8",
"description": "8 GB",
"id": 864,
"itemCategory": {
"categoryCode": "ram",
"id": 3,
"name": "RAM",
"quantityLimit": 0
},
"itemTaxCategoryId": 166,
"keyName": "RAM_8_GB",
"prices": [
{
"currentPriceFlag": "",
"hourlyRecurringFee": ".085",
"id": 112677,
"itemId": 864,
"laborFee": "0",
"locationGroupId": 503,
"onSaleFlag": "",
"oneTimeFee": "0",
"packageReferences": [
{
"id": 891477,
"itemPriceId": 112677,
"packageId": 46
}
],
"quantity": "",
"recurringFee": "56.75",
"setupFee": "0",
"sort": 0
}
],
"softwareDescriptionId": "",
"units": "GB",
"upgradeItemId": ""
},
What's wrong with this APIs?
Can you make double check please? because I verified that Portal is displaying the same price than API. I believe the price that you saw was for other datacenter.
Select first the datacenter: TOR01 - Toronto
Check the price for RAM 8 GB

Instagram API and Pagination

I can't get all images using Instagram API, Pagination seems to be working somehow different and I can't understand it yet
I use request:
https://api.instagram.com/v1/users/self/media/recent?access_token=TOKEN
and can get first 20 photos:
...
{
"attribution": null,
"tags": [
"beautiful",
"instalife",
"picoftheday",
"beauty",
"instalike",
"gf",
"traveling",
"instatravel",
"vsco",
"tourism",
"\u0438\u0441\u043f\u0430\u043d\u0438\u044f",
"travelphoto",
"vscogood",
"instafollow",
"travel",
"\u0433\u0440\u0430\u043d\u0430\u0434\u0430",
"amazing",
"vscocam",
"followme",
"photooftheday"
],
"type": "image",
"location": null,
"comments": {
"count": 1
},
"filter": "Normal",
"created_time": "1442825564",
"link": "https:\/\/instagram.com\/p\/74vm3GOCEn\/",
"likes": {
"count": 18
},
"images": {
"low_resolution": {
"url": "https:\/\/scontent.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s320x320\/e15\/11934647_531283580370186_1131008999_n.jpg",
"width": 320,
"height": 320
},
"thumbnail": {
"url": "https:\/\/scontent.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/s150x150\/e15\/11934647_531283580370186_1131008999_n.jpg",
"width": 150,
"height": 150
},
"standard_resolution": {
"url": "https:\/\/scontent.cdninstagram.com\/hphotos-xap1\/t51.2885-15\/e15\/11934647_531283580370186_1131008999_n.jpg",
"width": 612,
"height": 612
}
},
"users_in_photo": [
],
"caption": {
"created_time": "1442825564",
"text": "#\u0413\u0440\u0430\u043d\u0430\u0434\u0430 #\u0418\u0441\u043f\u0430\u043d\u0438\u044f #photooftheday #picoftheday #instalike #followme #vscogood #vscocam #vsco #instafollow #travel #traveling #instatravel #instalife #tourism #gf #beauty #beautiful #amazing #travelphoto",
"from": {
"username": "solotravel_me",
"profile_picture": "https:\/\/igcdn-photos-h-a.akamaihd.net\/hphotos-ak-xaf1\/t51.2885-19\/11282631_115839268762391_863189534_a.jpg",
"id": "736938591",
"full_name": "and"
},
"id": "1078821495951073761"
},
"user_has_liked": false,
"id": "1078821489441513767_736938591",
"user": {
"username": "solotravel_me",
"profile_picture": "https:\/\/igcdn-photos-h-a.akamaihd.net\/hphotos-ak-xaf1\/t51.2885-19\/11282631_115839268762391_863189534_a.jpg",
"id": "736938591",
"full_name": "and"
}
}
...
after that I'm trying use max_id parameter, but I'm not sure which ID I need to use
I tried id of the photo, photo_user id, I even tried timestamp (found this idea on some forum), but every time I receive only first 20 photos
example:
https://api.instagram.com/v1/users/self/media/recent?access_token=TOKEN&max_id=1078821495951073761
I was having the same problem with the empty pagination object while the account actually had more photos.
And just to make things clear here. This question is answered in the comments of the origial question.
There is nothing in the pagination object because the app is in sandbox mode and app's in sandbox mode never returns more than 20 posts(photos).
Use this API for getting all posts of the user:
https://i.instagram.com/api/v1/feed/user/{user_id}
For pagination, the parameter name is max_id
Pass max_id which you have returned in this API's response.
Hope this helps !!