Was this helpful?
Itineraries as well as Itinerary Locations can contain a number of media elements, including Photos.
Before you associate a photo with an itinerary, you will need to upload photos to the platform, or alternatively use an photo from a photo sharing site such as unsplash.
You can associate the photo to the media using the updateItinerary()
mutation
with the field createMedia()
field on the UpdateItineraryInput
type.
1# Updates an itinerary with a selection of photos.
2
3mutation UpdateItineraryPhotos {
4 # Use the updateItinerary() operation to update the itinerary media
5 updateItinerary(
6 # Specify the itinerary
7 id: "itinerary/ABC123"
8 # Update the itinrary content
9 itinerary: {
10 # Create the itinerary media
11 createMedia: [
12 # Create a photo based on a user upload
13 { resourceId: "media/ABC123" }
14 # Create a photo based on an unsplashed photo
15 { resourceId: "media/unsplash:photo:XXX" }
16 ]
17 }
18 ) {
19 # Query back the itinerary updated fields
20 itinerary {
21 id
22 __typename
23
24 # Read in the media
25 mediaContainers(first: 10) {
26 edges {
27 node {
28 # Media container id
29 id
30 __typename
31
32 # Read back the uploaded photo resource
33 resource {
34 __typename
35 ... on MediaImage {
36 id
37 # ... selection of fields
38 }
39 }
40 }
41 }
42 }
43 }
44 }
45}
Sandbox: Configure | Try Operation
In addition to the above createMedia
data, you can also updateMedia
,
moveMedia
and deleteMedia
. This gives you control over performing a series
of updates to control the media. It is also possible to create the itinerary
with the media supplied as the input in the createItinerary()
mutation.
The itinerary locations mutation resembles a very similar GraphQL mutation as for the itinerary.
1# Updates an itinerary location with a selection of photos.
2
3mutation UpdateItineraryLocationPhotos {
4 # Use the updateItineraryLocation() operation to update the itinerary media
5 updateItineraryLocation(
6 # Specify the itinerary location
7 id: "itinerary/ABC123/location/DEF123"
8 # Update the itinerary location content
9 location: {
10 # Create the itinerary media
11 createMedia: [
12 # Create a photo based on a user upload
13 { resourceId: "media/ABC123" }
14 # Create a photo based on an unsplashed photo
15 { resourceId: "media/unsplash:photo:XXX" }
16 ]
17 }
18 ) {
19 # Query back the itinerary updated fields
20 location {
21 id
22 __typename
23
24 # Read in the media
25 mediaContainers(first: 10) {
26 edges {
27 node {
28 # Media container id
29 id
30 __typename
31
32 # Read back the uploaded photo resource
33 resource {
34 __typename
35 ... on MediaImage {
36 id
37 # ... selection of fields
38 }
39 }
40 }
41 }
42 }
43 }
44 }
45}
Sandbox: Configure | Try Operation
The order in which the operations are applied to the collection is:
Delete
Update
Move
Create
remove media within the same update mutation.
Copyright © 2024 - Made with love ❤️ in Australia.