Strapi 4.6 back-end with Nextjs 13 as front-end - next.js

How can I get the image stored in Strapi 4.6 displayed on the screen with nextjs 13:
export default function Page({ params }) {
let movie = use(getMovie(params.movieID));
console.log("Movie This is the text", movie);
//console.log(params.movieID);
//console.log("Database output !!!", movie.${params.movieID}.?populate=*);
//const API_URL = ('http://127.0.0.1:1337');
return (
<div>
<p className="text-3xl">{movie.data.attributes.title}</p>
<p className="mt-2">Year: {movie.data.attributes.year}</p>
<p className="mt-2">Description: {movie.data.attributes.description}</p>
<Image className='mt-2'
src={movie.data.attributes.image.data.attributes.url}
alt={movie.data.attributes.title}
width={500}
height={349}
/>
</div>
);
}
The Title, year, and description of the movie are fixable on the screen.
On de server side I am receiving the following error:
event - compiled client and server successfully in 145 ms (545 modules)
The requested resource isn't a valid image for /uploads/2008_Jaden_3c49c0fe45.jpg received text/html; charset=utf-8
The settings of my next.config.js file are:
/** #type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
images: {
remotePatterns: [
{
protocol: "http",
hostname: "127.0.0.1",
port: "1337",
pathname: "/**",
},
],
},
};
module.exports = nextConfig;
Strapi 4.6 return the following API:
// 20230217152302
// http://127.0.0.1:1337/api/movies?populate=*
{
"data": [
{
"id": 1,
"attributes": {
"createdAt": "2023-02-03T15:39:55.796Z",
"updatedAt": "2023-02-07T11:39:47.652Z",
"publishedAt": "2023-02-03T15:40:08.569Z",
"title": "Lord of the Rings",
"year": 2001,
"description": "A meek Hobbit from the Shire and eight companions set out on a journey to destroy the powerful One Ring and save Middle-earth from the Dark Lord Sauron",
"slug": "lord-of-the-rings",
"image": {
"data": {
"id": 3,
"attributes": {
"name": "6FDUBGB.jpg",
"alternativeText": null,
"caption": null,
"width": 2000,
"height": 2496,
"formats": {
"thumbnail": {
"name": "thumbnail_6FDUBGB.jpg",
"hash": "thumbnail_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 125,
"height": 156,
"size": 8.49,
"url": "/uploads/thumbnail_6_FDUBGB_f8b45dbbae.jpg"
},
"small": {
"name": "small_6FDUBGB.jpg",
"hash": "small_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 401,
"height": 500,
"size": 62.75,
"url": "/uploads/small_6_FDUBGB_f8b45dbbae.jpg"
},
"medium": {
"name": "medium_6FDUBGB.jpg",
"hash": "medium_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 601,
"height": 750,
"size": 117.55,
"url": "/uploads/medium_6_FDUBGB_f8b45dbbae.jpg"
},
"large": {
"name": "large_6FDUBGB.jpg",
"hash": "large_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 801,
"height": 1000,
"size": 182.81,
"url": "/uploads/large_6_FDUBGB_f8b45dbbae.jpg"
}
},
"hash": "6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 597.08,
"url": "/uploads/6_FDUBGB_f8b45dbbae.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:39:40.120Z",
"updatedAt": "2023-02-07T11:39:40.120Z"
}
}
}
}
},
{
"id": 2,
"attributes": {
"createdAt": "2023-02-03T15:42:51.349Z",
"updatedAt": "2023-02-07T11:40:12.979Z",
"publishedAt": "2023-02-03T15:42:52.112Z",
"title": "Star Wars",
"year": 1977,
"description": "Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a Wookiee and two droide to save the galaxy from the Empire's wold-destroying battle station, while also attemting te rescue Princess Leia from the mysterious Darth Vader.",
"slug": "star-wars",
"image": {
"data": {
"id": 4,
"attributes": {
"name": "2008 Jaden.jpg",
"alternativeText": null,
"caption": null,
"width": 1868,
"height": 1304,
"formats": {
"thumbnail": {
"name": "thumbnail_2008 Jaden.jpg",
"hash": "thumbnail_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 223,
"height": 156,
"size": 9.92,
"url": "/uploads/thumbnail_2008_Jaden_3c49c0fe45.jpg"
},
"small": {
"name": "small_2008 Jaden.jpg",
"hash": "small_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 500,
"height": 349,
"size": 35.21,
"url": "/uploads/small_2008_Jaden_3c49c0fe45.jpg"
},
"medium": {
"name": "medium_2008 Jaden.jpg",
"hash": "medium_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 750,
"height": 524,
"size": 65.83,
"url": "/uploads/medium_2008_Jaden_3c49c0fe45.jpg"
},
"large": {
"name": "large_2008 Jaden.jpg",
"hash": "large_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 1000,
"height": 698,
"size": 102.08,
"url": "/uploads/large_2008_Jaden_3c49c0fe45.jpg"
}
},
"hash": "2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 258.7,
"url": "/uploads/2008_Jaden_3c49c0fe45.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:40:06.583Z",
"updatedAt": "2023-02-07T11:40:06.583Z"
}
}
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 2
}
}
}
Hopefully someone can help me out?
Thanks on forehand for your help!
Robert

Strapi only returns the relative paths of your images (or media in general). You need to prepend those paths with the URL/domain on which your Strapi is hosted.
E.g:
"http://127.0.0.1:1337" + "/uploads/2008_Jaden_3c49c0fe45.jpg"
"https://my-hosted-strapi.com" + "/uploads/2008_Jaden_3c49c0fe45.jpg"

Related

Nextjs 13 displaying an Image

I am using the experimental app version of Nextjs 13.
My next.config.js looks like this:
/** #type {import('next').NextConfig} */
const nextConfig = {
experimental: {
appDir: true,
},
images: {
remotePatterns: [
{
protocol: 'http',
hostname: '127.0.0.1',
port: '1337',
pathname: '/api/**',
},
],
},
};
module.exports = nextConfig;
I make the following call to display an image on the screen:
<Image className='mt-2'
src={movie.data.attributes.image.data.attributes.url}
alt={movie.data.attributes.title}
width={500}
height={350}
/>
</div>
On the server side I am getting the following response:
The requested resource isn't a valid image for /uploads/2008_Jaden_3c49c0fe45.jpg received text/html; charset=utf-8
The image name is correct. And the title displayed is also correct.
It seems that the system is still pointing to the local folder /uploads instead of to the remote host that I configured in the next.config.js file.
I have tried and changed many things but I am unable to display the images. Hopefully someone can help me out?
Robert
I am using the following version:
Next.js 13.1.6
React 18.0.27
And for my backend
Strapi 4.6.1
The Strapi API route looks like this:
// 20230217152302
// http://127.0.0.1:1337/api/movies?populate=*
{
"data": [
{
"id": 1,
"attributes": {
"createdAt": "2023-02-03T15:39:55.796Z",
"updatedAt": "2023-02-07T11:39:47.652Z",
"publishedAt": "2023-02-03T15:40:08.569Z",
"title": "Lord of the Rings",
"year": 2001,
"description": "A meek Hobbit from the Shire and eight companions set out on a journey to destroy the powerful One Ring and save Middle-earth from the Dark Lord Sauron",
"slug": "lord-of-the-rings",
"image": {
"data": {
"id": 3,
"attributes": {
"name": "6FDUBGB.jpg",
"alternativeText": null,
"caption": null,
"width": 2000,
"height": 2496,
"formats": {
"thumbnail": {
"name": "thumbnail_6FDUBGB.jpg",
"hash": "thumbnail_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 125,
"height": 156,
"size": 8.49,
"url": "/uploads/thumbnail_6_FDUBGB_f8b45dbbae.jpg"
},
"small": {
"name": "small_6FDUBGB.jpg",
"hash": "small_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 401,
"height": 500,
"size": 62.75,
"url": "/uploads/small_6_FDUBGB_f8b45dbbae.jpg"
},
"medium": {
"name": "medium_6FDUBGB.jpg",
"hash": "medium_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 601,
"height": 750,
"size": 117.55,
"url": "/uploads/medium_6_FDUBGB_f8b45dbbae.jpg"
},
"large": {
"name": "large_6FDUBGB.jpg",
"hash": "large_6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 801,
"height": 1000,
"size": 182.81,
"url": "/uploads/large_6_FDUBGB_f8b45dbbae.jpg"
}
},
"hash": "6_FDUBGB_f8b45dbbae",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 597.08,
"url": "/uploads/6_FDUBGB_f8b45dbbae.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:39:40.120Z",
"updatedAt": "2023-02-07T11:39:40.120Z"
}
}
}
}
},
{
"id": 2,
"attributes": {
"createdAt": "2023-02-03T15:42:51.349Z",
"updatedAt": "2023-02-07T11:40:12.979Z",
"publishedAt": "2023-02-03T15:42:52.112Z",
"title": "Star Wars",
"year": 1977,
"description": "Luke Skywalker joins forces with a Jedi Knight, a cocky pilot, a Wookiee and two droide to save the galaxy from the Empire's wold-destroying battle station, while also attemting te rescue Princess Leia from the mysterious Darth Vader.",
"slug": "star-wars",
"image": {
"data": {
"id": 4,
"attributes": {
"name": "2008 Jaden.jpg",
"alternativeText": null,
"caption": null,
"width": 1868,
"height": 1304,
"formats": {
"thumbnail": {
"name": "thumbnail_2008 Jaden.jpg",
"hash": "thumbnail_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 223,
"height": 156,
"size": 9.92,
"url": "/uploads/thumbnail_2008_Jaden_3c49c0fe45.jpg"
},
"small": {
"name": "small_2008 Jaden.jpg",
"hash": "small_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 500,
"height": 349,
"size": 35.21,
"url": "/uploads/small_2008_Jaden_3c49c0fe45.jpg"
},
"medium": {
"name": "medium_2008 Jaden.jpg",
"hash": "medium_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 750,
"height": 524,
"size": 65.83,
"url": "/uploads/medium_2008_Jaden_3c49c0fe45.jpg"
},
"large": {
"name": "large_2008 Jaden.jpg",
"hash": "large_2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"path": null,
"width": 1000,
"height": 698,
"size": 102.08,
"url": "/uploads/large_2008_Jaden_3c49c0fe45.jpg"
}
},
"hash": "2008_Jaden_3c49c0fe45",
"ext": ".jpg",
"mime": "image/jpeg",
"size": 258.7,
"url": "/uploads/2008_Jaden_3c49c0fe45.jpg",
"previewUrl": null,
"provider": "local",
"provider_metadata": null,
"createdAt": "2023-02-07T11:40:06.583Z",
"updatedAt": "2023-02-07T11:40:06.583Z"
}
}
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"pageCount": 1,
"total": 2
}
}
}

Cosmos db query to fetch data where array item is not null

I have Collection items in my cosmos db container.My sample data is
{
"objectID": "abc",
"id": "123",
"name": "gfh",
"description": "chock",
"brand": "hcn",
"size": 180,
"sizeUnits": "Grams",
"stores": []
},
{
"objectID": "123c",
"id": "0dfg",
"name": "shaek",
"description": "7ihk",
"brand": "fghcn",
"size": 768,
"sizeUnits": "Grams",
"stores": [ {
"id": 678",
"price": 2.2
},
{
"id": 678",
"price": 2.2}]
}
and so on...
I need to fetch all the details whose stores is empty. How to write query for this.
Please try this SQL:
SELECT * FROM c where ARRAY_LENGTH(c.stores) > 0
Result:
[
{
"objectID": "123c",
"id": "0dfg",
"name": "shaek",
"description": "7ihk",
"brand": "fghcn",
"size": 768,
"sizeUnits": "Grams",
"stores": [
{
"id": 678,
"price": 2.2
},
{
"id": 678,
"price": 2.2
}
]
}
]

How can I get read receipts from LinkedIn Voyager API?

I want to see if the last message has been seen by the person who I have sent the message to. I have got 20 conversation back from hitting this endpoint:
https://www.linkedin.com/voyager/api/messaging/conversations
I am using JSessions and cookies to authenticate. This is one of the conversations I got back:
{
"notificationStatus": "ACTIVE",
"read": true,
"groupChat": false,
"totalEventCount": 27,
"unreadCount": 0,
"lastActivityAt": 1613499552905,
"firstMessageUrn": "urn:li:fs_event:(6408489350996336640,S6408489350996336640_500)",
"backendUrn": "urn:li:messagingThread:2-MDYyMDFmMTUtMzk5NS01MTg2LWE1YWMtYzc2Y2JlYzNjYjE1XzAwMA==",
"receipts": [
{
"fromEntity": "urn:li:fs_miniProfile:ACoAACCRRgUBTOJXdRefeTMNta2hGPxadGDnNrA",
"seenReceipt": {
"seenAt": 1613498927377,
"eventUrn": "urn:li:fs_event:(6408489350996336640,S6767504989536559104_500)"
},
"fromParticipant": {
"string": "urn:li:member:546391557"
}
}
],
"archived": false,
"blocked": false,
"entityUrn": "urn:li:fs_conversation:6408489350996336640",
"viewerCurrentParticipant": true,
"featureTypes": [
"REACTIONS",
"CREATE_NEW_GROUP_CHAT"
],
"withNonConnection": false,
"muted": false,
"events": [
{
"createdAt": 1613499552888,
"reactionSummaries": [],
"dashEntityUrn": "urn:li:fsd_message:S6767507628659757056_500",
"quickReplyRecommendations": [],
"entityUrn": "urn:li:fs_event:(6408489350996336640,S6767507628659757056_500)",
"eventContent": {
"com.linkedin.voyager.messaging.event.MessageEvent": {
"messageBodyRenderFormat": "DEFAULT",
"body": "",
"attributedBody": {
"text": "some more text"
}
}
},
"subtype": "MEMBER_TO_MEMBER",
"from": {
"com.linkedin.voyager.messaging.MessagingMember": {
"miniProfile": {
"memorialized": false,
"firstName": "Sepideh",
"lastName": "Falah",
"occupation": "Software Engineer at SocialCycle",
"objectUrn": "urn:li:member:192299229",
"entityUrn": "urn:li:fs_miniProfile:ACoAAAt2QN0ByntmuEeEZB7874UZ84rt5wR4sL4",
"publicIdentifier": "sepideh-falah-33949854",
"picture": {
"com.linkedin.common.VectorImage": {
"artifacts": [
{
"width": 100,
"fileIdentifyingUrlPathSegment": "100_100/0/1516745437487?e=1619049600&v=beta&t=WXbHMyBCelbHjHoWSEVbi4TydR7qMeehH15FWpJYIao",
"expiresAt": 1619049600000,
"height": 100
},
{
"width": 200,
"fileIdentifyingUrlPathSegment": "200_200/0/1516745437487?e=1619049600&v=beta&t=66x3s8Hw5BvedUqu1RZ2TNazf2o0y9amUAJbKIx2nLI",
"expiresAt": 1619049600000,
"height": 200
},
{
"width": 400,
"fileIdentifyingUrlPathSegment": "400_400/0/1516745437487?e=1619049600&v=beta&t=MM1mHaQP6KTfNgJRIEuPQ0_2l76eA-DQbt0v4SiVs-0",
"expiresAt": 1619049600000,
"height": 400
},
{
"width": 800,
"fileIdentifyingUrlPathSegment": "800_800/0/1516745437487?e=1619049600&v=beta&t=YW7bUQO8Vpext2at7SW5FQhuot81Xk1HCnbJ_2jdjAI",
"expiresAt": 1619049600000,
"height": 800
}
],
"rootUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEJ4t5ijWZ8Xg/profile-displayphoto-shrink_"
}
},
"trackingId": "ZJXqw5fwRdCZPQpx0d1yhw=="
},
"entityUrn": "urn:li:fs_messagingMember:(6408489350996336640,ACoAAAt2QN0ByntmuEeEZB7874UZ84rt5wR4sL4)",
"nameInitials": "SF"
}
},
"previousEventInConversation": "urn:li:fs_event:(6408489350996336640,S6767504989536559104_500)",
"originToken": "07ea6a5d-7450-4a22-b5f4-ceb599e16ab4",
"backendUrn": "urn:li:messagingMessage:2-MTYxMzQ5OTU1MjY4NGI3NTYwOS0wMDEmMDYyMDFmMTUtMzk5NS01MTg2LWE1YWMtYzc2Y2JlYzNjYjE1XzAwMA=="
}
],
"participants": [
{
"com.linkedin.voyager.messaging.MessagingMember": {
"miniProfile": {
"memorialized": false,
"firstName": "Trevor",
"lastName": "Johnson",
"occupation": "Software Developer at Axway",
"objectUrn": "urn:li:member:546391557",
"entityUrn": "urn:li:fs_miniProfile:ACoAACCRRgUBTOJXdRefeTMNta2hGPxadGDnNrA",
"publicIdentifier": "johnson-trevor",
"picture": {
"com.linkedin.common.VectorImage": {
"artifacts": [
{
"width": 100,
"fileIdentifyingUrlPathSegment": "100_100/0/1524789372523?e=1619049600&v=beta&t=9ystm3UQKcVGh6sc5OYOkc8NjA0KzGwo9XRrNOYZOJo",
"expiresAt": 1619049600000,
"height": 100
},
{
"width": 200,
"fileIdentifyingUrlPathSegment": "200_200/0/1524789372523?e=1619049600&v=beta&t=nIqjHKqUN9N2_cXGfG4iDcfxjJkC7DGGDKD_yawbm40",
"expiresAt": 1619049600000,
"height": 200
},
{
"width": 400,
"fileIdentifyingUrlPathSegment": "400_400/0/1524789372523?e=1619049600&v=beta&t=l1fwjGmn-cxqwc5S-1IF5Y1HWg99akHkUQt3caorZPA",
"expiresAt": 1619049600000,
"height": 400
},
{
"width": 800,
"fileIdentifyingUrlPathSegment": "800_800/0/1524789372523?e=1619049600&v=beta&t=pj8u5JMqmLVuEFKNSbPT8fg7UfXTDE82wsJ6Uc6Urio",
"expiresAt": 1619049600000,
"height": 800
}
],
"rootUrl": "https://media-exp1.licdn.com/dms/image/C5603AQGDs9cCCR0HSw/profile-displayphoto-shrink_"
}
},
"trackingId": "Yvzot8irQWmbRWKMpIRKKg=="
},
"entityUrn": "urn:li:fs_messagingMember:(6408489350996336640,ACoAACCRRgUBTOJXdRefeTMNta2hGPxadGDnNrA)",
"nameInitials": "TJ"
}
}
]
}
Append conversationUrn to the link you are using.
I see that "entityUrn": "urn:li:fs_conversation:6408489350996336640"
In that case URL will be:
https://www.linkedin.com/voyager/api/messaging/conversations/6408489350996336640/events
It will return you the list of messages (events) from 1 specified above conversation with details of every message.
BTW, it's interesting that in your case conversationUrn is 6408489350996336640. Usually it looks like 2-MGQxMGNkMTctNGIxOS00N2RhLTgyMmUtNDE0MzAyYjI1ODRkXzAxMg==

ARM Template error error code invalidTemplate "Circular Dependancy Detected

I am new to deploying ARM templates. Before I created the ARM template I created a simple infrastructure consisting of 1 VM, 1 VNet, and 1 storage account. Once I finished provisioning the infrastructure, I decided to make a template for future use. I went under automation scripts, and I saved it to the library and then I also downloaded it. So, I wanted to change the SSD disk tier in the template from Standard D2S_V1 to E2S_V3. So I did that. I saved the changes and then I decided to test it out by deploying the template. After this, I got an error code that says the following:
Deployment template validation failed: 'Circular dependency detected on resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleRev2/providers/Microsoft.Network/networkInterfaces/simplevm18'. Please see https://aka.ms/arm-template/#resources for usage details.'. (Code: InvalidTemplate)
So, I tried to do my own research by checking out these links:
https://social.msdn.microsoft.com/Forums/en-US/c5782362-3a04-47fe-b5ec-87e5f488e844/deployment-failed-with-arm-template?forum=WAVirtualMachinesforWindows
https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-group-define-dependencies
I understand that the circular dependency error means that the dependOn property may be having issues. So I went in the template and looked at them, because it mainly has to do with the vnet resources specified in the template. What I'm not sure is, do I need to change the name of the vnet, pub ip, nsg, and nic? Or, is it something else. Here I'm going to attach the template in JSON:
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachines_SimpleVM_name": {
"defaultValue": "SimpleVM",
"type": "String"
},
"virtualNetworks_SimpleVNet_name": {
"defaultValue": "SimpleVNet",
"type": "String"
},
"networkInterfaces_simplevm18_name": {
"defaultValue": "simplevm18",
"type": "String"
},
"publicIPAddresses_SimpleVM_ip_name": {
"defaultValue": "SimpleVM-ip",
"type": "String"
},
"storageAccounts_simplestorage1_name": {
"defaultValue": "simplestorage1",
"type": "String"
},
"networkSecurityGroups_SimpleVM_nsg_name": {
"defaultValue": "SimpleVM-nsg",
"type": "String"
},
"subnets_default_name": {
"defaultValue": "default",
"type": "String"
},
"securityRules_default_allow_rdp_name": {
"defaultValue": "default-allow-rdp",
"type": "String"
},
"virtualMachines_SimpleVM_id": {
"defaultValue": "/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Compute/disks/SimpleVM_OsDisk_1_e66aaeca090f4ff5a3021460b8255a30",
"type": "String"
}
},
"variables": {},
"resources": [
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Compute/virtualMachines/SimpleVM'.",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachines_SimpleVM_name')]",
"apiVersion": "2017-03-30",
"location": "centralus",
"scale": null,
"properties": {
"hardwareProfile": {
"vmSize": "Standard_E2S_v3"
},
"storageProfile": {
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2016-Datacenter",
"version": "latest"
},
"osDisk": {
"osType": "Windows",
"name": "[concat(parameters('virtualMachines_SimpleVM_name'),'_OsDisk_1_e66aaeca090f4ff5a3021460b8255a30')]",
"createOption": "FromImage",
"caching": "ReadWrite",
"managedDisk": {
"storageAccountType": "Premium_LRS",
"id": "[parameters('virtualMachines_SimpleVM_id')]"
},
"diskSizeGB": 128
},
"dataDisks": []
},
"osProfile": {
"computerName": "[parameters('virtualMachines_SimpleVM_name')]",
"adminUsername": "susan",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
},
"secrets": []
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_simplevm18_name'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "https://loadbaldiag639.blob.core.windows.net/"
}
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaces_simplevm18_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Network/networkInterfaces/simplevm18'.",
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('networkInterfaces_simplevm18_name')]",
"apiVersion": "2017-10-01",
"location": "centralus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "5cced9eb-2dee-4f5a-9768-7098c140bfba",
"ipConfigurations": [
{
"name": "ipconfig1",
"etag": "W/\"a2959053-241e-49fc-9ee6-ae6dd8f9a2ac\"",
"properties": {
"provisioningState": "Succeeded",
"privateIPAddress": "10.5.0.4",
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_SimpleVM_ip_name'))]"
},
"subnet": {
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_SimpleVNet_name'), parameters('subnets_default_name'))]"
},
"primary": true,
"privateIPAddressVersion": "IPv4"
}
}
],
"dnsSettings": {
"dnsServers": [],
"appliedDnsServers": [],
"internalDomainNameSuffix": "4k34gmmtgvzetdldyabe4m2uwh.gx.internal.cloudapp.net"
},
"macAddress": "00-0D-3A-94-FA-26",
"enableAcceleratedNetworking": false,
"enableIPForwarding": false,
"networkSecurityGroup": {
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_SimpleVM_nsg_name'))]"
},
"primary": true,
"virtualMachine": {
"id": "[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_SimpleVM_name'))]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses', parameters('publicIPAddresses_SimpleVM_ip_name'))]",
"[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('virtualNetworks_SimpleVNet_name'), parameters('subnets_default_name'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_SimpleVM_nsg_name'))]",
"[resourceId('Microsoft.Compute/virtualMachines', parameters('virtualMachines_SimpleVM_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Network/networkSecurityGroups/SimpleVM-nsg'.",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[parameters('networkSecurityGroups_SimpleVM_nsg_name')]",
"apiVersion": "2017-10-01",
"location": "centralus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "0af138ab-8f42-4b94-b440-46525541955e",
"securityRules": [
{
"name": "default-allow-rdp",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
}
],
"defaultSecurityRules": [
{
"name": "AllowVnetInBound",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"description": "Allow inbound traffic from all VMs in VNET",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "VirtualNetwork",
"destinationAddressPrefix": "VirtualNetwork",
"access": "Allow",
"priority": 65000,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
},
{
"name": "AllowAzureLoadBalancerInBound",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"description": "Allow inbound traffic from azure load balancer",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "AzureLoadBalancer",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 65001,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
},
{
"name": "DenyAllInBound",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"description": "Deny all inbound traffic",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 65500,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
},
{
"name": "AllowVnetOutBound",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"description": "Allow outbound traffic from all VMs to all VMs in VNET",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "VirtualNetwork",
"destinationAddressPrefix": "VirtualNetwork",
"access": "Allow",
"priority": 65000,
"direction": "Outbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
},
{
"name": "AllowInternetOutBound",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"description": "Allow outbound traffic from all VMs to Internet",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "Internet",
"access": "Allow",
"priority": 65001,
"direction": "Outbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
},
{
"name": "DenyAllOutBound",
"etag": "W/\"ece2fb9b-8e13-4434-ac2a-c5800b3b3c56\"",
"properties": {
"provisioningState": "Succeeded",
"description": "Deny all outbound traffic",
"protocol": "*",
"sourcePortRange": "*",
"destinationPortRange": "*",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Deny",
"priority": 65500,
"direction": "Outbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
}
}
]
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Network/publicIPAddresses/SimpleVM-ip'.",
"type": "Microsoft.Network/publicIPAddresses",
"sku": {
"name": "Basic"
},
"name": "[parameters('publicIPAddresses_SimpleVM_ip_name')]",
"apiVersion": "2017-10-01",
"location": "centralus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "6ebcb25d-2340-4438-bfa5-8301ba372db9",
"ipAddress": "52.173.136.16",
"publicIPAddressVersion": "IPv4",
"publicIPAllocationMethod": "Dynamic",
"idleTimeoutInMinutes": 4
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Network/virtualNetworks/SimpleVNet'.",
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworks_SimpleVNet_name')]",
"apiVersion": "2017-10-01",
"location": "centralus",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "31e3bbf2-3593-4972-8d63-c0024f3394b7",
"addressSpace": {
"addressPrefixes": [
"10.5.0.0/16"
]
},
"subnets": [
{
"name": "default",
"etag": "W/\"add0de6e-d14d-4511-b107-739686a5dd70\"",
"properties": {
"provisioningState": "Succeeded",
"addressPrefix": "10.5.0.0/24"
}
}
],
"virtualNetworkPeerings": [],
"enableDdosProtection": false,
"enableVmProtection": false
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Storage/storageAccounts/simplestorage1'.",
"type": "Microsoft.Storage/storageAccounts",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
},
"kind": "Storage",
"name": "[parameters('storageAccounts_simplestorage1_name')]",
"apiVersion": "2017-10-01",
"location": "centralus",
"identity": {
"principalId": "ba12dbb9-d280-4037-ae54-8ce938863a41",
"tenantId": "f3c4e7bf-60d1-40db-aa86-fcf229eb6d77",
"type": "SystemAssigned"
},
"tags": {},
"scale": null,
"properties": {
"networkAcls": {
"bypass": "AzureServices",
"virtualNetworkRules": [],
"ipRules": [],
"defaultAction": "Allow"
},
"supportsHttpsTrafficOnly": false,
"encryption": {
"services": {
"file": {
"enabled": true
},
"blob": {
"enabled": true
}
},
"keySource": "Microsoft.Storage"
}
},
"dependsOn": []
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Network/networkSecurityGroups/SimpleVM-nsg/securityRules/default-allow-rdp'.",
"type": "Microsoft.Network/networkSecurityGroups/securityRules",
"name": "[concat(parameters('networkSecurityGroups_SimpleVM_nsg_name'), '/', parameters('securityRules_default_allow_rdp_name'))]",
"apiVersion": "2017-10-01",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"protocol": "TCP",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 1000,
"direction": "Inbound",
"sourcePortRanges": [],
"destinationPortRanges": [],
"sourceAddressPrefixes": [],
"destinationAddressPrefixes": []
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroups_SimpleVM_nsg_name'))]"
]
},
{
"comments": "Generalized from resource: '/subscriptions/7b790d29-944d-4f0f-861b-928e4774cde9/resourceGroups/SimpleVM/providers/Microsoft.Network/virtualNetworks/SimpleVNet/subnets/default'.",
"type": "Microsoft.Network/virtualNetworks/subnets",
"name": "[concat(parameters('virtualNetworks_SimpleVNet_name'), '/', parameters('subnets_default_name'))]",
"apiVersion": "2017-10-01",
"scale": null,
"properties": {
"provisioningState": "Succeeded",
"addressPrefix": "10.5.0.0/24"
},
"dependsOn": [
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworks_SimpleVNet_name'))]"
]
}
]
}
the template is pretty big, i wont be able to look at it. but the error means that you have a dependency loop in your template. you need to analyze dependsOn and reference() in the template to detect it.
because both of these act as a dependency "marker"

Wordpress API V2 does not embed items when query parameter is passed

Per the documentation:
Optionally, some linked resources may be included in the response to
reduce the number of HTTP requests required. These resources are
“embedded” into the main response.
Embedding is triggered by setting the _embed query parameter on the
request. This will then include embedded resources under the _embedded
key adjacent to the _links key. The layout of this object mirrors the
_links object, but includes the embedded resource in place of the link
properties.
Despite this, when I make the following GET request:
http://anawins.com/wp-json/wp/v2/posts/2986?_embed
The resulting JSON is identical the request without ?_embed.
With embed:
{
"id": 2986,
"date": "2016-05-09T03:00:42",
"date_gmt": "2016-05-09T07:00:42",
"guid": {
"rendered": "http:\/\/anawins.com\/?p=2986"
},
"modified": "2016-05-08T16:37:39",
"modified_gmt": "2016-05-08T20:37:39",
"slug": "the-secret-to-speaking-with-more-grace",
"type": "post",
"link": "http:\/\/anawins.com\/the-secret-to-speaking-with-more-grace\/",
"title": {
"rendered": "The Secret to Speaking With Grace"
},
"content": {
"rendered": "<p><img class=\"aligncenter size-large wp-image-3474\" src=\"http:\/\/anawins.com\/wp-content\/uploads\/2016\/05\/the-secret-to-speaking-with-grace-367x550.png\" alt=\"Do you...."
},
"excerpt": {
"rendered": "<p>I have a little..."
},
"author": 2,
"featured_media": 0,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"format": "standard",
"categories": [193, 58],
"tags": [110, 194, 206, 205, 204],
"better_featured_image": null,
"_links": {
"self": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986"
}],
"collection": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts"
}],
"about": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/types\/post"
}],
"author": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/users\/2"
}],
"replies": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/comments?post=2986"
}],
"version-history": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986\/revisions"
}],
"wp:attachment": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/media?parent=2986"
}],
"wp:term": [{
"taxonomy": "category",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/categories?post=2986"
}, {
"taxonomy": "post_tag",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/tags?post=2986"
}],
"curies": [{
"name": "wp",
"href": "https:\/\/api.w.org\/{rel}",
"templated": true
}]
}
}
Without _embed:
{
"id": 2986,
"date": "2016-05-09T03:00:42",
"date_gmt": "2016-05-09T07:00:42",
"guid": {
"rendered": "http:\/\/anawins.com\/?p=2986"
},
"modified": "2016-05-08T16:37:39",
"modified_gmt": "2016-05-08T20:37:39",
"slug": "the-secret-to-speaking-with-more-grace",
"type": "post",
"link": "http:\/\/anawins.com\/the-secret-to-speaking-with-more-grace\/",
"title": {
"rendered": "The Secret to Speaking With Grace"
},
"content": {
"rendered": "<p><img class=\"aligncenter size-large wp-image-3474\" src=\"http:\/\/anawins.com\/wp-content\/uploads\/2016\/05\/the-secret-to-speaking-with-grace-367x550.png\" alt=\"Do you struggle..."
},
"excerpt": {
"rendered": "<p>I have a little..."
},
"author": 2,
"featured_media": 0,
"comment_status": "open",
"ping_status": "open",
"sticky": false,
"format": "standard",
"categories": [193, 58],
"tags": [110, 194, 206, 205, 204],
"better_featured_image": null,
"_links": {
"self": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986"
}],
"collection": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts"
}],
"about": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/types\/post"
}],
"author": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/users\/2"
}],
"replies": [{
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/comments?post=2986"
}],
"version-history": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/posts\/2986\/revisions"
}],
"wp:attachment": [{
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/media?parent=2986"
}],
"wp:term": [{
"taxonomy": "category",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/categories?post=2986"
}, {
"taxonomy": "post_tag",
"embeddable": true,
"href": "http:\/\/anawins.com\/wp-json\/wp\/v2\/tags?post=2986"
}],
"curies": [{
"name": "wp",
"href": "https:\/\/api.w.org\/{rel}",
"templated": true
}]
}
}
How do I change the query to make this work?

Resources